Logging session ID in each entry

Hi all,
I'm trying to log the session ID in each log entry, so that I'm able to see which log entry belonged to which session when analysing the log file later.
I'm using log4j and I think the right way to do stuff like this is to push the session ID to the NDC (nested diagnostic context, see http://logging.apache.org/log4j/docs/api/org/apache/log4j/NDC.html).
Now I'm having trouble to find the right place where to push this ID to the NDC and when to remove it again. The NDC is thread based, but I'm not sure how this fits into the JSF model.
I tried to use PhaseListeners, one before the RESTORE_VIEW (NDC.push()), and one after RENDER_RESPONSE (NDC.remove()), but this leads to multiple session IDs being in the NDC after a few requests.
Any idea how to fix this cleanly? Or any other approach?
Thanks a lot,
Gunnar

CowKing,
thanks for your reply. I already keep the session ID (along with other data) in a session bean, but I don't want to explicitly output the ID - I had to change all calls to the logger, and I wouldn't be able to simply turn this on or off (and many other more disadvantages) - see also http://wiki.apache.org/logging-log4j/NDCvsMDC for more info about NDC, if you're interested.
I've been searching the web quite a while now, and I hardly find anything useful. I'm really irritated because I believe this is a quite important thing to have in a multi-client application.
Rgds,
Gunnar

Similar Messages

  • Multiple users logged into one server, each users printer has a different name, application needs ONE name to print to.

    Multiple users logged into one server, each users printer has a different name, application needs ONE name to print to. 
    I'm NOT in any way a Terminal Services expert and I need help trying to get an application program working in a multi-user environment.
    The issue is that the printer changes for every user that is logged in. The application needs to print NOT to the default printer, but to a "special" printer which is selected in the application... let's call it a label printer to simplify the explanation.
    You have your default regular printer, easy for the application to find that one, and then you have a special printer that labels get printed onto. The application needs to know what printer is the label printer. So we allow the user to select that in the
    application and the selection is stored in a config file in 
    C:\ProgramData\mfgr\prog\setting files
    I don't have access to the application so I can't change how this works.  
    In the "regular" world, selecting the label printer driver to use should be per machine, NOT per user. When a new user logs into a machine, the physical printer doesn't go "poof" and a new printer suddenly appear. Same printer for all
    users.
    Yet in terminal services, the physical machine is "merged" with the virtual machine on the server. And there can be many users logged in at the same time. So each users real machine (and real printer) is injected into the "fake" terminal
    services machine. The name of the printers is made unique for each user. So the printers DO go "poof" and change names depending on the user logged into terminal services.
    So user "A" logs in and sets up the application to print to "LabelPrinterForUserA" (or whatever the name of the printer happens to be), that setting is stored in the ProgramData subfolder, and all is well. Later, user "B" logs
    in, and when they print, the application tries to print to "LabelPrinterForUserA" which doesn't exist for user B or is only accessible by user A. If user B re-configures, that breaks it for user A. 
    SOLUTION 1: The way that /should/ work (in my mind) is that you define one "generic" printer in Terminal Services... call it "Virtual Label printer" and when the user wants to print to it, the print job gets re-directed back to whatever
    physical printer is actually connected to their local workstation. There is a map of virtual printer to actual printer depending on the current user. The application is told once to print to "Virtual Label Printer" for all users.
    SOLUTION 2: Or... there should be some way to make the ProgramData sub folders separate per user. E.g. when user "A" tries to access:
    C:\ProgramData\mfgr\prog\setting files
    they actually get 
    C:\UserData\UserA\AppData\mfgr\prog\setting files
    and user "B" gets
    C:\UserData\UserB\AppData\mfgr\prog\setting files
    So the question I have is: Does either of those solutions exist hidden somewhere in the setup of terminal server? Or is there another way around this issue that I don't know?

    I don't really have a "for sure" answer to this, but because people here can't seem to deal with a question that hasn't been answered I'll provide the best answer I did receive from ServerFault.com user Nathan:
    I can feel your pain with using old software on terminal servers ...the solution I've come up with definitely won't scale as it requires some manual configuration, but I've gotten this method to work with our label printers (which require to be
    printed to an LPT port...yep, that old).
    Share your USB-connected printers to the network on each machine. Then, have the user log in on aunique session for each of them
    (a TS account cannot be shared among computers for this to work) and install a network printer pointing to the USB one they shared. Try to use a DNS name to account for possible DHCP movements.
    After, it should work. Each user can do this since display names can be identical as long as the ports are different (which they are).
    This was clarified by the following series of comments:
    I think you are on to something here, and I originally advised the admin to do this. The problem he ran into is that it setup the printer names in the TS as "printer on usersworkstation"
    and he could not rename it except to change the "printer" to whatever. E.g. the "on userworkstation" remained. I believe there is another way of installing the printer which avoids this, but I can't find it. Ages ago, one used to do NET
    USE LPT2 \\computer\printer password /USER:domain\user /PERSISTENT:YES and then tell the driver to print to LPT2 –  James
    Newton Mar
    17 at 16:21   
    @JamesNewton That's actually the exact method we used. The way around the "network printer" part is to install it as local printer and map it to a TCP/IP port that way. –  Nathan
    C Mar
    17 at 16:28
    You mean in the case where the printers are TCP/IP connected and not local USB / LPT to the users workstation? That makes sense. Wonder if this will work for USB connected printers... –  James
    NewtonMar
    17 at 16:35   
    @JamesNewton You'd share the local printer on the client's PC then on the server connect via TCP/IP to it. You'd need static addresses or use DNS names if DHCP, though. –  Nathan
    C Mar
    17 at 16:51
    Ah. Yes. I see. Looks like the LPT thing should work even with a USB connected printer:superuser.com/questions/182655/… –  James
    Newton Mar
    17 at 17:09   

  • How do I control a data log session with period and sample time?

    I need a data logging system where the operator can select 2 logging parameters: Log Period and Sample Time. I also need a START and STOP button to control the logging session. For example, set the log period for 1 hour and the sampling time for 1 second. (I may be using the wrong jargon here.) In this case when the START button is clicked, the system starts logging for 1 second. An hour later, it logs data for another second, and so on until the operator clicks the STOP button. (I will also include a time limit so the logging session will automatically stop after a certain amount of time has elapsed.)
    It’s important that when the STOP button is clicked, that the system promptly stops logging. I cannot have the operator wait for up to an hour.
    Note that a logging session could last for several days. The application here involves a ship towing a barge at sea where they want to monitor and data log tow line tension. While the system is logging, I need the graph X-axis (autoscaled) to show the date and time. (I’m having trouble getting the graph to show the correct date and time.) For this application, I also need the system to promptly start data logging at a continuous high rate during alarm conditions.
    Of course I need to archive the data and retrieve it later for analysis. I think this part I can handle.
    Please make a recommendation for program control and provide sample code if you can. It’s the program control concepts that I think I mostly need help here. I also wish to use the Strip Chart Update Mode so the operator can easily view the entire logging session.
    DAQ Hardware: Not Selected Yet
    LabVIEW Version: 6.1 (Feel free to recommend a v7 solution because I need to soon get it anyway.)
    Operating System: Win 2000
    In summary:
    How do I control a graphing (data log) session for both period and sample time?
    How do I stop the session without having to wait for the period to end?
    How do I automatically interrupt and control a session during alarm conditions?
    Does it make a difference if there is more than one graph (or chart) involved where there are variable sample rates?
    Thanks,
    Dave

    Hello Dave,
    Sounds like you have quite the system to set up here. It doesn�t look like you are doing anything terribly complicated. You should be able to modify different examples for the different parts of your application. Examples are always the best place to start.
    For analog input, the �Cont Acq&Chart (buffered).vi� example is a great place to start. You can set the scan rate (scans/second) and how many different input channels you want to acquire. This example has its own stop button; it should be a simple matter to add a manual start button. To manually set how long the application runs, you could add a 100 ms delay to each iteration of the while loop (recommended anyway to allow processor to multi-task) and add a control that sets the number
    of iterations of the while loop.
    For logging data, a great example is the �Cont Acq to File (binary).vi� example.
    For different sample rate for different input lines, you could use two parallel loops both running the first example mentioned above. The data would not be able to be displayed on the same graph, however.
    If you have more specific questions about any of the different parts of your application, let me know and I�ll b happy to look further into it.
    Have a nice day!
    Robert M
    Applications Engineer
    National Instruments
    Robert Mortensen
    Software Engineer
    National Instruments

  • My husband and i share a macbook. we each have our own log-in and we each have our own itunes account. how can we share our libraries?

    My husband and I share a macbook. We each have our own log-in and we each have our own itunes account. How can we use home sharing?

    First, you need to understand that there's a difference between "syncing" and "backup".  Backup is the saving of content and settings, where syncing is the bidirectional transfer of content for an account to a web-based server (like iCloud, Gmail, Yahoo, etc.)
    If you see your calendar in your iCloud account, that implies that you have set up your iCloud account to host (sync) your calendar, and perhaps contacts, email, and notes.  An iCloud account can only sync one user's information at a time so it is intended to support a single user.  You can have more than one iCloud account, and you can even have more than one iCloud account on the same device (but one has to be primary, and the secondary iCloud has limited capabilities), but a single iCloud account only supports a single user's content.
    Backup is the saving of your device's content and settings to use in case you need to recover these things, but you can't see the contents of your backup (just the size and device name).  You can backup more than one device to iCloud and you can backup to iCloud or you can backup to your computer, or both (one at a time though, you have to choose). 
    So, if your wife has her own email and calendar she can certainly do that in parallel to whatever account(s) you have for email and calendar.  But if you have only one iCloud account then only one of you can use it for email, calendar, etc.  But the backup of these accounts is really just a backup of the device's settings that link the device to these accounts. For example, if she uses Gmail then the backup of the iPad only backs up the fact that your iPad is set up to use her account, it does not backup the account itself (the content of her account is saved and preserved on Google's servers, not your device's backup).
    Does that make better sense?

  • Report for time log on detail for each employees in SAP ABAP-HR report

    hi experts,
          please help me .how to create a report for time log on detail for each employees in SAP ABAP-HR report.please help me.
                                                      thank you

    Hi,
    For Time Management Infotypes , If you want to read the data using macro you need to use the Macro called RP_READ_ALL_TIME_ITY
    Example:
    DATA: BEGDA LIKE P2001-BEGDA, ENDDA LIKE P2001-ENDDA.
       INFOTYPES:  0000, 0001, 0002, ...
                         2001 MODE N, 2002 MODE N, ...
         GET PERNR.
       BEGDA = '19900101'. ENDDA = '19900131'.
       RP_READ_ALL_TIME_ITY BEGDA ENDDA.
       IF PNP-SW-AUTH-SKIPPED-RECORD NE '0'.
          WRITE: / 'Authorization for time data missing'.
          WRITE: / 'for personnel number', PERNR-PERNR. REJECT.
       ENDIF.

  • Pkg execution session id in all tables and Session Id of each interface

    Hi
    I am have one master package executing all interfaces for Staging and Target. Each staging interface loads the data from source to staging tables and target interface loads data from staging to Target. Each table has a column named ETL Batch Id and ETL Session Id. Our designer asked us to populate the ETL Batch Id with the Pkg execution id which will be same in all tables and also the ETL Session Id with the respective interface scenario execution session id which will be different in each table.
    Question: 1. What is the purpose and advantage of storing ETL Batch Id in each table?
    2. What is the purpose and advantage of storing ETL Session Id in each table?
    3. Do I need both? (1 and 2)
    BTW the ET design is for Star Schema (Data mart)
    Thanks
    OBIEE Fan

    This is really a question for your designer - there may be valid reasons why you'd want to store the session ID - maybe to help with break analysis or data quality monitoring. If you store the session ID in a table then you should be able to work out the "batch ID" by looking at the work repository/operator. But again, whether you "need" them is a question for your designer.
    ODI may update rows as well as insert, so there may be considerations there as to how you tell the difference.
    Edited by: _Phil on Oct 9, 2012 9:45 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to display a DIV or not, based on whether a logging session cookie exists or not?

    Hi everyone
    I have created a logging system for a simple CMS using Dreamweaver server behaviours.
    My problem :
    When logged in, I would like to show on my pages a DIV saying something like "You are logged in". If not logged in, I would like a different DIV with this text saying "Please log in"
    I have simplified the problem as much as I could. Basically, I would like to show something or to hide it and show another thing based on whether the logging session exists or not. Would someone have a simple answer to this problem?
    Much obliged, W

    Thanks HJ
    Your answer helped me find more info about cookies and session which is what I actually needed.
    So I can show a particular item based on whether an admin user is logged in, I proceed as follow.
    First I check whethet the session exists. If he has just logged in using Dreamweaver logging system, the session will exist. So put the text above the <head> and preferably at the very top of the page.
    <?php
    if (!isset($_SESSION)) {
      session_start();
    ?>
    Then in the content portion of the page where I want to display, say a DIV with some content for the administrator I place the following :
    <?php
    $accessLevels = array('a','b');
    $validLevel = $_SESSION['MM_UserGroup'];
    if(array_search($validLevel, $accessLevels)>-1){
    ?>
    <div id="amendPage" style="margin-left:0;margin-top:0;height:20px;"><a href="/admin/changePage.php">Changez le contenu de cette page</a></div>
    <?php
    ?>
    I am checking here whether the user is logged in based on his or her access level which I have previously set in the database. 'a' being an access level and 'b' an other one which might enable more things. So I can play with this array to show something to someone based on the access level.
    If I were to remove 'b' from the array, the div would only be visible when a user with an 'a' access level is logged in and vice versa.
    Not sure whether this is a good option, but it works for me

  • R12 log session issues

    R12 is ending log session although i was working in an order and now i can't log in again need to close IE complete and than restart.please help me to resolve this
    Edited by: 878218 on Aug 9, 2011 2:41 AM

    Hi;
    What is ICX:SESSION TIME OUT parameter on your system?
    Please see:
    ICX:SESSION TIME OUT
    Re: Inccreasing the timeout  parameter for the Oracle R12 session
    Also see:
    How AutoConfig sets ICX: Session Timeout [ID 307149.1]
    How To Manage Timeout at Responsibility Level [ID 412224.1]
    Regard
    Helios

  • Checking; How do I get a balance computed after each entry?

    Checking: How do I get a balance posted after each entry?

    Specific answer depends on how you've set up the checkbook table.
    Assumed:
    Dates in column A
    Cheque numbers in B
    Cheques/withdrawls in C
    Deposits in D
    Running total in E.
    Opening balance in E1 (a Header row cell)
    in E2:
    =IF(C+D=0,"",E1-C+D)
    The first part of the IF statement keeps the cell (vusually) empty until an amount is entered into either column C or D. If either column has an amount entered, the current balance is calculated and displayed on that row.
    Fill the formula down through the rest of column E.
    Regards,
    Barry

  • HT3231 I have completed migration, is it possible to merge the two account now? or a short cut to share information? I don't want to log in and out each time I want to see my old data.

    I have completed migration, is it possible to merge the two account now? or a short cut to share information? I don't want to log in and out each time I want to see my old data.

    No, the camera connection kit only supports the copying of photos and videos to the Photos app, it doesn't support copying content off the iPad. For your second camera instead of the SD reader part of the kit, does the iPad to camera cable not work with it for direct transfer to the iPad ?
    For Lightroom and Nikon software again no - you can only install apps that are available in the iTunes app store on your computer and the App Store app on the iPad, 'normal' PC and Mac (OS X) software are not compatible with the iPad (iOS). There are some apps that perform fairly basic editing functions that are available in the store, but nothing as sophisticated as, for example, Lightroom.

  • AB: Everything appears twice in each entry

    After a nightmare of sync failures with my mobile phone I have an Address Book where everything appears twice for each entry: for a person X the phone numbers, e-mail addresses etc appear twice. I can remove the entries for some persons, but for some other persons removing the private address removes all private addresses for this entry.
    Any hints how I can solve this problem?
    Thanks in advance,
    Boris

    Not sure what phone you're using, but after similar nightmares (it's always a good idea to create a back up before synchronizing, so you can delete the messed up address book and import the back up in case of a problem).
    I got Mark Space's Missing Sync and it synchronized properly...so my advice is to start fresh from a backup (if you have one) and use MS.

  • Why do I need to log into my homepage each time I open up firefox.

    Ever time I open up Firefox I must log into each of my homepages,AOL, Yahoo, and Comcast. This just started all of a sudden, when I use Internet Explore it works just fine. Please help I hate to use Internet Explore I have been using Firefox for years its been a great product Thanks for all of your hard work. Craig Pelletier.

    Websites remembering you and automatically log you in is stored in a cookie.
    * Create an allow cookie exception (Tools > Options > Privacy > Cookies: Exceptions) to keep such a cookie, especially for secure websites and if cookies expire when Firefox is closed.
    * In [[Private Browsing]] mode all cookies are session cookies that expire if that session is ended, so websites won't remember you.
    to store new passwords.
    * Do not use [[Clear Recent History]] to clear the "Cookies" and the "Site Preferences"
    Clearing "Site Preferences" clears all exceptions for cookies, images, pop-up windows, software installation, and passwords.
    * http://kb.mozillazine.org/Cookies

  • First row for each entry

    hi
    i have sorted the internal table by field f1 and i need to insert the first row for each f1 entry.
    I tried AT NEW f1. But that doesnt seem to work.
    Kindlly help.
    Thanks.

    *--ENSURE THAT age IS FIRST FIELD IN INTERNAL TABLE it_gir while declaring it.....
    SORT it_gir BY age ASCENDING.
    LOOP AT it_gir INTO wa_gir.
    AT NEW age.
    <b>*--if there are fields which are getting populated with **** instead of original values....then use below statement...</b>
    read table it_gir index sy-tabix.
    MOVE-CORRESPONDING wa_gir TO wa_final1.
    APPEND wa_final1 TO it_final1.
    clear wa_final1.
    ENDAT.
    ENDLOOP.
    now it should definitely work.....
    if not check in debugging mode if data exists or not....!!!
    Regards
    Vasu

  • Why must I log in to Facebook each time I want to access it?

    For the past few weeks, I must log into Facebook every time I access it on my iPad.  This does not happen on my iMac and, until a few weeks ago, it did not happen on my iPad.  Each time it shows the iPad as a new device and I get an email telling me that.  It now shows that I have registered 87 devices!  I am quite sure I have a setting not right but I don't know what it is. How can I fix this so I do not have to log in as though I have a new device each time?

    Hi there anthonyfromsound beach,
    You may find the troubleshooting steps in the article below helpful if iTunes is repeately asking for authorization.
    iTunes repeatedly prompts to authorize computer to play iTunes Store purchases
    -Griff W.  

  • How do I get rid of an "uninstal set"message that comes up with each entry? h new page?

    The message box appears with each new page or entry and locks up the machine until removed.. Some times the X and EXT must be pressed several times to get rid of the box

    Other users have reported that this is caused by one of their add-ons. I suggest going to the Add-ons page and disabling everything that is not essential, and then restarting Firefox. Hopefully it's not caused by something you really rely on.
    orange Firefox button ''or'' Tools menu > Add-ons > Extensions
    Any luck?

Maybe you are looking for

  • Can't delete items in my calendar

    HI! I'm using the Mozilla Thunderbird calendar on my computer at work and I was previously syncing it with the iPhone calendar using Google calendar, but that didn't work out too well as meetings we're placed at the wrong time and as I couldn't even

  • Camera turns dark

    Hi everybody. I have my iPhone4 for about 5 weeks now and I really like it. But at times I have a bit of a problem using the camera. The camera works fine but suddenly the cam turns dark. Restarting the camera app doesn't help. When I move the camera

  • Back up and sync my Iphone to my pc and some apps wont sync?

    I used an AppleID yrs ago to buy some apps on my Iphone well now I am trying to sync my Iphone to my itunes account on my pc and it wont allow me to cos it says my pc isnt authorized for it. It wants me to put in my password for those apps and I not

  • SAP HR Benefits

    Hi all , I need the documents on SAP HR-Benefits. Regards santosh .

  • Where are movies shared to Apple devices stored exactly? When I shut down FCPX the shared movie disappears from iTunes.

    FCPX v10.2 Destination settings: Apple Devices 1080p Video Codec: H.264 Better Quality Resolution: 1920x1080 Add to playlist: Library Many thanks for anyone who can help me before I completely lose my mind!