Semantic Logging Custom sink logs multiple times Event entry

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Practices.EnterpriseLibrary.SemanticLogging;
using Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using System.Globalization;
using System.IO;
using Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling;
using Microsoft.WindowsAzure.Storage.RetryPolicies;
namespace SemanticLogging.CustomSink
public class AzureBlobSink : IObserver<EventEntry>
private readonly IEventTextFormatter _formatter;
private string ConnectionString { get; set; }
private string ContainerName { get; set; }
private string BlobName { get; set; }
public AzureBlobSink() : base()
System.Net.WebRequest.DefaultWebProxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
public AzureBlobSink(string connectionString, string containerName, string blobname) : base()
this.ConnectionString = connectionString;
this.ContainerName = containerName;
this.BlobName = blobname;
_formatter = new EventTextFormatter();
public void OnCompleted()
//throw new NotImplementedException();
public void OnError(Exception error)
//throw new NotImplementedException();
SemanticLoggingEventSource.Log.CustomSinkUnhandledFault("Exception: " + error.Message + Environment.NewLine + "Stack trace:" + error.StackTrace + Environment.NewLine + "Inner Exception" + error.InnerException + Environment.NewLine);
public void OnNext(EventEntry value)
if (value != null)
using (var writer = new StringWriter())
_formatter.WriteEvent(value, writer);
Postdata(Convert.ToString(writer), BlobName);
/// <summary>
/// create container and upsert block blob content
/// </summary>
/// <param name="content"></param>
private void Postdata(string content, string blobname)
List<string> blockIds = new List<string>();
var bytesToUpload = Encoding.UTF8.GetBytes(content);
//to set default proxy
System.Net.WebRequest.DefaultWebProxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
try
using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(content),false))
CloudStorageAccount account = CloudStorageAccount.Parse(ConnectionString);
CloudBlobClient blobClient = account.CreateCloudBlobClient();
//linear Retry Policy create a blob container 10 times. The backoff duration is 2 seconds
IRetryPolicy linearRetryPolicy = new LinearRetry(TimeSpan.FromSeconds(2), 10);
//exponential Retry Policy which retries the code to create a blob container 10 times.
IRetryPolicy exponentialRetryPolicy = new ExponentialRetry(TimeSpan.FromSeconds(2), 10);
blobClient.RetryPolicy = linearRetryPolicy;
CloudBlobContainer container = blobClient.GetContainerReference(ContainerName);
container.CreateIfNotExists();
CloudBlockBlob blob = container.GetBlockBlobReference(blobname + System.DateTime.UtcNow.ToString("MMddyyyy") + ".log");
//stream.Seek(0, SeekOrigin.Begin);
if (!blob.Exists())
using (var insertempty = new MemoryStream(Encoding.UTF8.GetBytes("")))
blob.UploadFromStream(insertempty);
blockIds.AddRange(blob.DownloadBlockList(BlockListingFilter.Committed).Select(b => b.Name));
var newId = Convert.ToBase64String(Encoding.UTF8.GetBytes(blockIds.Count.ToString(CultureInfo.InvariantCulture).PadLeft(64, '0')), Base64FormattingOptions.None);
//var newId = Convert.ToBase64String(Encoding.Default.GetBytes(blockIds.Count.ToString()));
blob.PutBlock(newId, new MemoryStream(bytesToUpload), null);
blockIds.Add(newId);
blob.PutBlockList(blockIds);
catch (Exception ex)
SemanticLoggingEventSource.Log.CustomSinkUnhandledFault("Exception: " + ex.Message + Environment.NewLine + "Stack trace:" + ex.StackTrace + Environment.NewLine + "Inner Exception" + ex.InnerException + Environment.NewLine);
I have created custom sink for logging into azure blob.
The code below were giving issue. 
when i execute this method,
First time it write log one time in to blob 
second time it write log two time. 
n-th time it writes n entry to blob. 
Actually, the below code executed n time.
public void OnNext(EventEntry value)
if (value != null)
using (var writer = new StringWriter())
_formatter.WriteEvent(value, writer);
Postdata(Convert.ToString(writer), BlobName);
Help me!
Thanks, SaravanaBharathi.A

Hi Saravanabharathi,
Thank you for posting in here.
We are looking into this and will get back to you at earliest. Your patience is greatly appreciated.
Regards,
Manu Rekhar

Similar Messages

  • Time Evaluation with multiple time events

    Dear Friends,
    I have an issue in our current project. Kindly try to help me with a solution.
    We are working on Time Management module with Positive Time Recording method and evaluation- India. (Payroll module is not implemented)
    My issue is:
    Evaluation with multiple time events in a day: In our project, we have a scenario like the employees record multiple clock in and clock out times for one day and are uploaded into infotype 2011. But during time evaluation, only first Time event that is P10 (Clock In) and the last Time event P20 (Clock-out) in a day should be considered for evaluation, ignoring any multiple time entries in between duration in the table TEVEN (Infotype 2011).
    Pls let me know how this requirement can be met. Do we need to define any new PCR’s or create any functions? If yes, pls tell me the process in detail as I am new and implementing Time management (Positive Time recording with Evaluation) for first time. Try to help me as soon as possible.
    Thanks & Regards,
    Chiranjeevi
    Edited by: chiran reddy on Feb 15, 2008 2:20 PM

    is it not possible to enter only the first p10 and last p20 from the time systems into 2011.

  • Why do I have to log multiple times when checking available downloads from iTunes?

    It's been going on for some time now.
    I'm finally getting around to asking.
    Every SINGLE time I download an app update, or purchase something, iTunes makes me log in with my password 2, 3, sometimes 4 times in a row.
    All the while, what I purchased/updated is downloading to my Mac.
    I am not entering my password incorrectly.
    I am already logged in to the iTunes store.
    What can I do to make it stop?
    It's annoying!
    Thanks.

    Make sure you are signed into the iTunes Store with the correct username and password, see this for more info -> iOS: Changing the signed-in iTunes Store Apple ID account

  • JSF custom renderer executes multiple times

    I have just created a jsf custom component to render three input texts next to each other (for SSN input). My custom renderer extends javax.faces.render.Renderer, and I am writing out the elements in the encodeEnd method. The problem I encountered is - upon saving the form and the screen refreshes, the renderer gets called two times. So what I end up seeing on the screen are two sets of the three input texts component. Does anyone know why the renderer gets called more than once? Any insight is much appreciated.

    To the best of my knowledge, the standard does not specify the default renderer class for any components.
    I would take a wrapper/decorator approach. Add a field to your renderer for the default renderer. Before configuring your renderer, obtain the default renderer and set it on your renderer, then configure it.
    OTOH, there might be easier ways for you to accomplish what you want to do. You could use a PhaseListener to add components to the view whenever a commandButton is encountered in the tree.

  • Using an "OR" for monitoring multiple possible event entries

    Hi, I am doing a rule to monitor if people are added or removed from the domain admins, built in groups or enterprise admins on Windows 2008 DC's.
    This looks like it would be from events 4728, 4729, 4732, 4733, 4755 and 4756.
    I could write 6 rules but would prefer just one. I have been looking at "expressions" -
    http://support.microsoft.com/kb/2702651/en-gb
    but cant really get this going. I have tried 4278 | 4729 for instance as an OR but it dosent work..
    Any ideas?
    thanks

    Hi
    refer below link for how to create an event id rule
    http://blogs.technet.com/b/kevinholman/archive/2009/02/25/authoring-rules-for-windows-2008-events-and-how-to-cheat.aspx
    for AD
    http://opsmgrsolutions.wordpress.com/2010/05/17/scom-security-event-monitoring/
    https://blogs.technet.com/b/klince/archive/2011/05/18/how-to-configure-scom-to-monitor-for-changes-to-the-domain-admins-group.aspx
    Authoring 
    Regards
    sridhar v

  • Java SystemTray with timer event

    I have just recently began working with the java system tray feature. In my application I have took the example from http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/systemtray/ for an example as to how this works.
    My application also has a timer event that goes off every two seconds and checks for new messages. However if I open up the system tray popup menu, then the rest of the application hangs and waits for the pop up window to close. Is there any way to make the system tray so that the rest of the application does not freeze waiting for the menu to go away or a choice to be selected? I wold like the timer event to go off every 2 seconds, even if I have the system tray popup menu open.
    Thanks for any help or suggestions.

    Hmm. It's not that the Timer is stopped, it's that the TrayIcon displays the popup on the EDT and blocks actionPerformed -- which also has to run on the EDT -- till the popup is closed. Swing Timer by default coalesces multiple timer events when there's a backlog.
    As the showing of the popup is handled by the native peer, it doesn't look like there'll be any solution with a Swing Timer. Your problem should be solvable with java.util.Timer and TimerTask.
    Try this code, then uncomment the setCoalesce(false) and try it again. Note the difference.import java.awt.AWTException;
    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.Image;
    import java.awt.MenuItem;
    import java.awt.PopupMenu;
    import java.awt.SystemTray;
    import java.awt.TrayIcon;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.image.BufferedImage;
    import javax.swing.JFrame;
    import javax.swing.SwingUtilities;
    public class TrayIconTest {
       public static void main(String[] args) {
          SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
                new TrayIconTest().makeUI();
       public void makeUI() {
          PopupMenu popup = new PopupMenu();
          popup.add(new MenuItem("One"));
          popup.add(new MenuItem("Two"));
          TrayIcon trayIcon = new TrayIcon(getImage(), null, popup);
          try {
             SystemTray.getSystemTray().add(trayIcon);
          } catch (AWTException ex) {
             ex.printStackTrace();
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setSize(200, 200);
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
          javax.swing.Timer swingTimer = new javax.swing.Timer(1000, new ActionListener() {
             int count = 0;
             @Override
             public void actionPerformed(ActionEvent e) {
                System.out.println("Swing Count: " + count++);
          //swingTimer.setCoalesce(false);
          swingTimer.start();
          java.util.TimerTask timerTask = new java.util.TimerTask() {
             int count = 0;
             @Override
             public void run() {
                System.out.println("Util Count: " + count++);
          java.util.Timer utilTimer = new java.util.Timer();
          utilTimer.scheduleAtFixedRate(timerTask, 1200, 1000);
       private Image getImage() {
          BufferedImage image = new BufferedImage(16, 16,
                BufferedImage.TYPE_INT_ARGB);
          Graphics2D g2 = image.createGraphics();
          g2.setColor(Color.RED);
          g2.fillOval(1, 1, 14, 14);
          g2.setColor(Color.YELLOW);
          g2.fillOval(5, 5, 6, 6);
          return image;
    }db

  • Multiple time entry profile in ESS

    Hi ,
    We are implementing ESS on ECC6.0 and EP7.0.
    In R/3 side we have multiple time sheet entry profiles, how can we implement the time sheet entry scenario in portal which allows multiple entry profiles because as per my understanding ESS user in portal would only be having ESS profile assigned to them.
    Please let me know if we can have multimple profile implemented in portal.
    Thanks
    Ankur

    In the old versions of the ESS business package (ITS based), we had the flexibilty to use more than one Time Entry profiles.
    AFAIK, you might not be able to use more than one Time Entry Profile with the new versions of ESS BP (Webdynpro based). The application picks up the "CVR" parameter of the user. (Default profile is SAP).
    Thanks,
    Raj

  • Semantic Logging - RollingFlatFileSink - Real-Time Logging

    We're currently using semantic logging and are able to both save to rolling flat files and a sql database.
    A difference we're seeing is that the sql sink inserts every x seconds while the rolling flat file sink doesn't insert data until the file rolls over or the service stops. 
    Is there a way to have inserts happen in real-time for the rollingFlatFileSink?

    Please post questions related to this product in their
    forums at CodePlex.

  • HT1911 Why does Itunes have me logging in multiple times to buy a song? Somehow, my account got disabled now. It also shows that I am logged in....?

    Why does itunes have me logging in multiple times to buy a song? I can access everything else fine, but now my account is disabled for some reason although my password was entered correctly... help

    I've seen a couple of other threads over the last 10 minutes posting similar problems, so it appears to have affected other people as well - the poster on the first thread has now posted again saying that it's now working for him, so you could give it another try.
    Edit : your reply appeared as I was attempting to post this

  • HT5796 I was on a a different Apple ID and I logged out because they didn't want me on there anymore so I figured out how to make one and now it's not letting me upgrade or download anything. I rebooted my iPhone 5, iOS 7.0.4 multiple times nothing fixed

    I was on a a different Apple ID and I logged out because they didn't want me on there anymore so I figured out how to make one and now it's not letting me upgrade or download anything. I rebooted my iPhone 5, iOS 7.0.4 multiple times nothing fixed my problem.

    I was on a a different Apple ID and I logged out because they didn't want me on there anymore so I figured out how to make one and now it's not letting me upgrade or download anything. I rebooted my iPhone 5, iOS 7.0.4 multiple times nothing fixed my problem.

  • [svn:fx-trunk] 21141: Bug: 2780176 - Logging and logging out multiple times in LCDS can cause duplicate session detected errors .

    Revision: 21141
    Revision: 21141
    Author:   [email protected]
    Date:     2011-04-26 06:40:39 -0700 (Tue, 26 Apr 2011)
    Log Message:
    Bug: 2780176 - Logging and logging out multiple times in LCDS can cause duplicate session detected errors.
    QA: Yes
    Doc: No
    Checkintests: Pass
    Details: When a logout was followed by an immediate login, sometimes the server would throw duplicate session detected errors. This was because when logout happened, a fire-and-forget disconnect message was sent to the server that established a new session, and if the subsequent login happened before disconnect ACK returned from the server, that would establish another session and hence the error. The fix is to insert a slight delay between disconnect and ResultEvent dispatching. This way, disconnect has a chance to return before a login is performed.
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/ChannelSet.as

    You've got an  incompatible Logitech driver and java was incompletely uninstalled.
    You may have a problem with the Wacom driver.
    I don't know if fixing those things will help.
    There also a few window server errors, but I don't know if they are causal.
    If you can note the time of the hangs, that might help narrow it down in the logs.

  • I keep having to log into itunes multiple times

    This is really frustrating.  I keep having to log into iTunes every time I turn on my iPhone or iPad.  It happens multiple times each day on all of my families devices.  I'm not sure what is wrong.  Any help is appreciated.

    This can happen for different reasons. Permission issues derived from a cornucopia of other issues, security programs interfering with the login issue, bad sectors in a disk and I think only Adobe has a full list of the known reasons.
    I wouldn't think this is a connection issue too, but check with Adobe support to see if your license is really activating and deactivating or just keep activating like mad.
    Anyway, I would try to delete the OPM.DB file first and try to log in again. Check the solution 2 in this document: http://helpx.adobe.com/creative-cloud/kb/unknown-server-error-launching-cc.html
    If that doesn't work, check the logs: http://helpx.adobe.com/creative-suite/kb/troubleshoot-install-logs-cs5-cs5.html
    Go Win+R, type %temp% e look for 2 files, PDApp and ooblib. Check for ERROR and FATAL entries.
    There other steps you can try too, but these are the ones I would go for, first.

  • HT203128 Requirement to log in multiple times to iTunes????

    When I attempt to log on to iTunes, I now have to input my password three times before gaining access. Is this a common problem or a new security feature of iTunes?

    Hello outbackmariner,
    Welcome to the Apple Support Communities!
    I understand that you are being prompted to enter your Apple ID and password multiple times every time you open the program. It sounds to me like it is prompting you to authorize your computer to play purchased content. If this is the case, to resolve this issue, please read over and work through the troubleshooting steps within the attached article. 
    iTunes repeatedly prompts to authorize computer to play iTunes Store purchases - Apple Support
    Have a great day,
    Joe

  • Firefox won't sync to my Android device, even though I have logged in (to the new Sync), and unlinked and relinked my phone and PC multiple times. Help?

    Pretty much just what the question says. I got a new phone, logged into sync on Android, and my phone will not populate the information that it should from my sync account. I am running the new sync, am updated to the current version on both platforms, have all the appropriate boxes checked, and have tried logging out and then back in again, multiple times, in attempt to reset the sync to populate the information. Any help would be appreciated.
    Thank you.

    When you say 'Sync' do you mean to the cloud?
    I suspect there is some issue were space used is being reported incorrectly.
    My iPad mini only has a 97Mb file to sync to cloud (I don't try to sync much of it), I have 2.2 free space in the cloud, and it won't sync. I've also noticed that some games like Fieldrunners won't save games, nor will the Drawing Pad app save pics my kids create. All of these issues seem related to how the iPad views it's own use of space.
    Getting close to wiping the thing and starting again. Even an OS upgrade to 8.1.1 hasn't helped.

  • Photoshop CC 2014 Extension - CEP Event callback is triggered multiple times per single event

    Trying to make my extensions listen for bunch of events and it's turning out to be a real pain in the ***.
    I'm hoping there's someone here who has a bit more experience playing around with these.
    I used the example code from here ( Page 43 ): http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/creativesuite/pdfs/CC14_Extension_S DK.pdf
    I've modified the code just a little. I removed some unnecessary things from it. I also added a counter, to try to visualize the issue.
    Every time I pasted the code here, the global variable seemed to duplicate. So, eeeeh...  the example code can be found here.
    The problem is:
    I close one document to trigger the event, but for some reason the callback seems to run multiple times.
    Even better, it doesn't seem to be super consistent about it. Sometimes it repeats only couple of times and sometimes it repeats 160 times.
    It seems like every time the extension panel is reopened, it comes up with a new number.
    Currently, if I close a document, it seems to trigger the callback 15 times
    Since this is screenshot, you'll have to take my word for it. I only closed a single document and the code ran 15 times.
    Am I doing something wrong by any chance?
    edit:
    I believe I just found out the reason and a way to recreate the issue.
    I've occasionally tested the extension by closing and opening the panel, which seems to have caused the issue.
    It looks like every time I close and then open the panel, it... adds one more run time to the stack.
    - Refreshing the panel from chrome doesn't seem to affect it.
    When I restart photoshop, it resets. So after the very first opening of the panel, the event triggers the callback only once.
    I forgot to mention that the host application events work just fine without these issues.
    In fact, I tried to use documentAfterActivate before, but as far as I could find, there is no way to kind of filter out specific events within host application events.
    For instance, I can't specify something different to happen when a new document is opened.
    As very much a side note:
    documentAfterActivate has its own side effect due to the way photoshop works.
    It is triggered when you:
    Create a new document
    Open a new document
    Switch to an open document
    It's the "Switch to an open document" part that makes this event listener also trigger when you close a document.
    Because when you close a document, photoshop switches back to the previous document and that in turn triggers the event listener when it shouldn't, I suppose.
    Of course it doesn't trigger the event when you close the last document as there is no document to switch to at that point.
    ...but this is beyond the scope of the original question.

    I was so tired last night that when I found out the cause of it, I never even thought about unregistering...
    I decided to unregister it when the panel is opened instead.
    This does indeed get rid of the issue.
    Thanks, cbuliarca.
    (function () {
      var csInterface = new CSInterface();
      function init() {
           themeManager.init();
           function registerPhotoshopEvent(in_eventId, register) {
                // Added the next line
                var register = register === "clear" ? "UnRegisterEvent" : "RegisterEvent";
                // Modified the next line
                var event = new CSEvent("com.adobe.Photoshop" + register, "APPLICATION");
                event.extensionId = csInterface.getExtensionID();
                event.appId = csInterface.getApplicationID();
                event.data = in_eventId
                csInterface.dispatchEvent(event);
           var number = 0;
           csInterface.addEventListener("PhotoshopCallback" , function(event) {
                number = number + 1;
                console.log( number );
           var closeEventid = "1131180832"
           // Added the next line
           registerPhotoshopEvent(closeEventid, "clear");
           registerPhotoshopEvent(closeEventid);
      init();

Maybe you are looking for

  • Home directories from GUI work but not from command line

    I'm having trouble accessing home directories through SSH. After significant trouble, I reinstalled OS 10.4.6 Server on each of my 24 XServes. This is a HPC with an XServe RAID providing the storage space. I promoted the first XServe to an Open Direc

  • How can I "import" Facetime Camera with external USB microphone?

    In Final Cut Pro, there's an option to "import" the FaceTime Camera. BUT, it only works with the built in mic on my laptop. I also found a window for recording audio voiceovers That one lets me pic the mic, but doesn't have an option for video. Is th

  • Need help  - Ethernet question for DSL

    Hi, hoping someone can help me. We are looking into getting Verizon DSL internet, and don't know if we have the Ethernet specifications. We have a flat screen 17" iMac 1Ghz, Dh said he knows we have an ethernet connection but doesn't know about the c

  • JCMON shows the dialogs status UNKNOWN

    Hi - When I execute jcmon on the Central instance with option 10 : Cluster Administration Menu to  Display Instance List (option 1) , I get the dialog hostname status as UNKNOWN. The dialogs are up and running. System information: kernel release     

  • Problem with ListSelector

    Hello everybody, I found an error in my code : GRAVE: "Servlet.service()" pour la servlet jsp a lanc� une exception java.lang.ArrayIndexOutOfBoundsException: 32         at com.sun.rave.web.ui.component.ListSelector.getValueAsStringArray(ListSelector.