How come logging is so hard? - JDK1.4 Logging API

Have a small project on hand. A standalone java program trigged by unix cron job and do some data cleaning. Need to implement a very simple logger. Tried to use JDK1.4 Logging API, here's my code:
public class MyLogManager {
     public final static String NAME = "mylog";
     public final static String LOG_FILE_NAME = "C:/my.log";
     private static Logger logger;
     static {
          try {
               logger = Logger.getLogger(NAME);
               Handler fh = new FileHandler(LOG_FILE_NAME);
               fh.setFormatter(new SimpleFormatter());
               logger.addHandler(fh);
               logger.setLevel(Level.ALL);
          } catch (Exception e) {
               System.out.println("Unable to initialize logger: " + e.toString());
               System.exit(1);
     public static Logger getLogger() {
          return logger;
and use MyLogManager.getLogger().info("message") to log message.
It works and my.log was generated with log message. However, the problem is everytime a new job (java myprogam ...) runs, it deletes the old log file and create a new one.
I want the message to be appended by the end of old log file. What should I do? Any help?

Use log4j (google for it - it's on http://jakarta.apache.org).
If log4j.jar is in your classpath, the JDK 1.4 logging framework will use it automatically. Then all you have to do is to configure a log4j.properties file in your classpath to log wherever you want it to.
And log4j is sorta-smart about multiple programs logging to the same file.

Similar Messages

  • How come it's so hard to find my lost iPhone on my android phone

    Im having such a hard time finding my iPhone on my android device it's showing me the lication but uts a wrong location and my iphobe is completely dead any suggestions.

    Are you trying to locate it on icloud.com?  If so, try from a computer.  Of course, if your phone has no battery power it will be listed as offline, and the location shown (if any) could be as much as 24 hours old.
    You might also want to read this: http://support.apple.com/kb/HT5668.

  • How come i received an email confirming my second creative cloud payment 2 days ago and today i have logged on and i only have a free membership?

    about a month ago i signed up to the student creative cloud monthly subscription. today i have bought a new mac book and the first thing i did was install my creative cloud. after logging in and installed illustrator i realised that it had only installed the trial version. i then decided to log on online to see if there was any issues on there. after logging on and going to manage my account i discovered that according to online i have only got the free creative cloud memberhip. the reason i have an issue with this is that on Friday i received an email confirming my payment has gone through. so how come i am paying for a full student membership and then only receiving the trials?  as you can iamgine i am not impressed!

    Contact sales/ S&T support by web chat.
    Mylenium

  • How come My Sites can only be created when logged directly onto the Sharepoint Server?

    Hello Community
       In Synchronization I populate the container with OU's that contain
    Service accounts, user accounts created in the Sharepoint farm and a
    domain local group containing a OU with all of the trusted user accounts.
       AFter populating the container I perform a User Profile Synchronization.
       After the User Profile Synchronization finishes MIISClient shows "success"
    including the OU containing the trusted user accounts.
       Although I cannot Find all of the trusted users individually in Manage User Profile I
    can find them with the peoplepicker when I add them to the web application
    and the My Site Host application.
       The problem is if I logon directly onto the Sharepoint server with an account created
    in the Sharepoint farm I can create a My Site with that account. But if a trusted user
    logs onto their computer and tries to create a My Site they get an error stating
    the page can't be displayed.
        Even if I click "sign on as a different user" on the trusted user computer
    and with a user account that was created in the Sharepoint farm and try to create a
    My Site I get the error stating the page can't be displayed.
        The reason the page can't be displayed on the trusted users computer is because although
    it can access the My Site Host application it cannot access its default.aspx page.
        So the question is how come when creating a My Site the My Site Host default.aspx page
    cannot be accessed from the trusted user computer but when creating a My Site directly on
    the Sharepoint Server the default.aspx page can be accessed and the trusted user and/or the
    user account created in the farm can access the default.aspx page and create a My Site?
        Thank you
        Shabeaut

    What does that mean "trusted user computer"?
    How many servers you have in farm?
    Are you using a single domain or there are multiple domains involved ?
    Regards,
    Pratik Vyas | SharePoint Consultant |
    http://sharepointpratik.blogspot.com
    Posting is provided AS IS with no warranties, and confers no rights
    Please remember to click Mark As Answer if a post solves your problem or
    Vote As Helpful if it was useful.

  • If you log out of your apple ID on your iPad and let someone else use it and they use facetime.  How come it shows my facetime history and not theirs?   I do not want them to have access to my history.  How can I prevent that and they can see their own?

    If you log out of your apple ID on your iPAD mini and let someone else use it and they use facetime.  How come it shows my facetime history and not theirs?   I do not want them to have access to my history.  How can I prevent that and they can see their own?  Or is the history associated with the iPAD mini itself and not the actual icloud user account?

    You are logging out from
    Settings -> FaceTime, right?
    My guess would be though, that the FaceTime history is stored locally on the device, so anyone using it will see the entire device history (I cannot imagine that FaceTime uploads the history to an Apple server anywhere - I'm sure it is just logged locally on the device - based on my iPhone and iPad show completely different histories, for example).

  • How come when I send a picture with iPhoto email it always send the same picture event when I choose a different picture until I log out from iPhoto

    how come when I send a picture with iPhoto email it always send the same picture event when I choose a different picture until I log out from iPhoto

    Why? Because something is wrong.
    As a Test:
    Hold down the option (or alt) key and launch iPhoto. From the resulting menu select 'Create Library'
    Import a few pics into this new, blank library. Is the Problem repeated there?

  • TS3989 how come I'm not seeing my iphone photos and videos when I og in to icloud on my PC or online? When I log in to icloud the photos icon is missing.  I have photostream and icloud activated on my iphone..

    how come I'm not seeing my iphone photos and videos when Iog in to icloud on my PC or online? When I log in to icloud the photos icon is missing.  I have photostream and icloud activated on my iphone..

    There is no way to view your photos via iCloud.com. Videos are not uploaded.
    Photo Stream merely "pushes" the photos to your other devices.

  • How do I prove a Macbook Pro Log on password?

    How do I prove a Macbook Pro Log on password? I was told to open Teminal and type in password but I was not sure what the computer told me afterwards.  Is there another way to prove that I got my log on password correct before I Log off?

    if you are using 10.6 you can see passwords, unbeknown to me.  Read this article: http://www.macyourself.com/2009/08/03/how-to-reset-your-mac-os-x-password-withou t-an-installer-disc/

  • How can i see a detailed call log

    how can i see a detailed call log including actual numbers on restricted calls

    bobsouthernguy wrote:
    how can i see a detailed call log including actual numbers on restricted calls
    You won't see the numbers if the call came in as restricted...that's the point of a caller blocking their number.
    You can pay for a service like TrapCall that will give you the restricted numbers.  Or you can use a service (free) like DitchMail that gives callers a recording asking them to unblock their number and call back, if the call comes in with the number blocked.  It then hangs up without giving them the opportunity to leave a message.

  • How to backup files from other user logged in as administrator

    RE: How to backup files from other user logged in as administrator AND/OR how to repair drive with "Invalid catalog PEOF"
    Hello,
    My MacBook Pro computer’s hard drive is not booting.
    I booted with the base operating system and ran Disk utilities and I got the following messages:
        Invalid catalog PEOF
        The volume could not be verified completely.
        This disk needs to be repaired.
        Disk utility can’t repair this disk. Backup as many files as possible, reformat the disk,
        and restore your backed-up files.
    The problem is that I have a couple of USERS set up on this computer, and it won’t let me backup the files of the second user.  The folders are locked and I can’t access them, even though I am logged in as the administrator.
    I made a boot disk on my other computer ( a MacPro Early 2008 ) desktop computer with the DiskWarrior 4.4 updater,
    but it won’t boot on my MacBook Pro.
    How can I backup these user files so that I can copy them back once I fix the drive?
    or better yet,  How can I repair the Invalid catalog PEOF on this drive?
    Thank you in advance for your time! 
    Bill
    THIS IS THE COMPUTER
    ================
    17” MacBook Pro 2.8GHZ 4GB Ram (purchased in 2009).
    Model: A1297
    Running Mac OSX 10.9.5

    Try using Disk Utility/Restore to copy the backup to a new location. Please note that this will reformat the destination partition which will erase all data.
    Do a backup. Boot to the Recovery Volume (command - R on a restart or hold down the option/alt key during a restart and select Recovery Volume). Run Disk Utility Verify/Repair and Repair Permissions until you get no errors.  Reformat the drive using Disk Utility/Erase Mac OS Extended (Journaled), then click the Option button and select GUID. Then re-install the OS.
    OS X Recovery
    OS X Recovery (2)
    When you reboot, use Setup Assistant to restore your data.

  • In Lion, how do you bypass managed prefs when logging on?

    in Lion, how do you bypass managed prefs when logging on?

    Ahh, that's a Lion Server question...sorry, can't help.
    Someone else hopefully will be along to answer for you.
    EDIT: won't help you in the short-term, but long term might be worth investing in this:
    http://shop.oreilly.com/product/0636920022664.do

  • How to set and retrive the index log path stored by parameter LOG_DIRECTORY

    how to set and retrive the index log path stored by parameter LOG_DIRECTORY.

    http://download-west.oracle.com/docs/cd/B19306_01/network.102/b14213/lsnrctl.htm#sthref72
    http://download-west.oracle.com/docs/cd/B19306_01/network.102/b14213/cmctl.htm#sthref239

  • My wireless keyboard has come unpaired and I can't log in to my iMac to pair it...help!!

    Help...my wireless keyboard has some how come unpaired with my iMac...and since the keyboard does not work I can not log in to repair it.  Anyone know how to fix this??

    You can access your Mac from your iPhone or iPad through a remote desktop client like Splashtop or LogMeIn if you already have something like this installed. Are you sure that your keyboard is 'discoverable'? (Hold button until light comes on and then goes off. Release button, then depress agin. The light will come on, hold for for about 3 seconds then let go. The light on the keyboard should be blinking in a 3 flash succession.) If it doesn't connect to the Mac after this, you'll need to get/borrow/buy a USB Keyboard (It's always good to have one of these handy anyway when you have a wireless accessory setup as your main way of connecting with your Mac).  
    Once you do get in to your system, be sure and go to System Preferences>Bluetooth and make sure that the 'Discoverable' box is checked. Also, go on to the Advanced pane and make sure that the box that says "Open Bluetooth Setup Assistant at startup if no trackpad or mouse is detected" is Checked.
    Results?

  • How to Open Or read SQL Server log file .ldf

    Hi all,
    How to Open Or read SQL Server log file .ldf
    When ever we create database from sql server, it's create two file. (1) .mdf (2) .ldf.
    I want to see what's available inside the .ldf file.
    Thanks,
    Ashok

    I am not too sure but may be the below two undocumented commands might yield the desired result.
    DBCC Log
    Fn_dblog function
    Refer these links for more info,
    http://www.mssqlcity.com/Articles/Undoc/SQL2000UndocDBCC.htm
    http://blogs.sqlserver.org.au/blogs/greg_linwood/archive/2004/11/27/37.aspx
    http://searchsqlserver.techtarget.com/tip/0,289483,sid87_gci1173464,00.html
    Some 3rd party tools like Log Explorer can do the job for you.
    http://www.lumigent.com/products/le_sql.html
    - Deepak

  • How to disable chanllenging questions while user log in for first time

    Hi All,
    How to disable challenging questions while user log in for first time in OIM 10g and OIM 11g
    also i need to know how to change the Oracle logo with custom logo in both versions

    In 11G:
    To disable challenge questions at start up: http://download.oracle.com/docs/cd/E17904_01/doc.1111/e14308/system_props.htm#BABBDCJH (System Property Named: "Force to set question at start up)
    To change logo: http://download.oracle.com/docs/cd/E14571_01/doc.1111/e14309/uicust.htm#CHDIFJEJ
    In 10G:
    Dig the documentation.
    A suggestion, please go through the documents first as they have quite a bit of information.
    HTH,
    BB

  • Can any one please tell me how to write labview program for data logging in electric motor bike.

    Can any one please tell me how to write labview program for data logging in electric motor bike. I am going to use CompactRIO for getting wide range of data from various sensors in bike. I need to write labview program for data logging of temperature, voltage and speed of the bike. Can any one help me?

    Yes, we can.   
    I think the best place for you to start for this is the NI Developer Zone.  I recommend beginning with these tutorials I found by searching on "data log rio".  There were more than just these few that might be relevant to your project but I'll leave that for you to decide.
    NI Compact RIO Setup and Services ->  http://zone.ni.com/devzone/cda/tut/p/id/11394
    Getting Started with CompactRIO - Logging Data to Disk  ->  http://zone.ni.com/devzone/cda/tut/p/id/11198
    Getting Started with CompactRIO - Performing Basic Control ->  http://zone.ni.com/devzone/cda/tut/p/id/11197
    These will probably give you links to more topics/tutorials/examples that can help you design and implement your target system.
    Jason
    Wire Warrior
    Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!

Maybe you are looking for

  • Unable to Launch Application error while starting IR

    Dear friends I am not a BASIS trained person, but wearing different caps because I am the only SAP engineer in our company and so learning on the job. I have installed a new server that has (SAP ECC 6.0, EP and PI). This is an IDES version. The opera

  • Named.log entry - problem?

    Hi! I have running a DNS-Server on my MacOSX Server 10.5.7. Every day I find an entry in my named.log like this: +11-Jun-2009 04:01:18.352 checkhints: view com.apple.ServerAdmin.DNS.public: L.ROOT-SERVERS.NET/A (199.7.83.42) missing from hints+ +11-J

  • HT5622 I have a billings issue that is preventing me from updating my apps.

    There is a billing issue associated with my account that I would like resolved. <Email Edited By Host>

  • Please suggest a select query / sub query with out using any subprograms or

    source table: Three columns ORIGIN, DESTINATION,MILES Origin      Destination Miles Sydney      Melbourne      1000 Perth      Adelaide      3000 Canberra      Melbounre      700 Melbourne      Sydney           1000 Brisbane      Sydney           100

  • Extended idoc not populating(urgent)

    hi guys i have extended the basic idoc type delvry03 and created an extension delvrtext for it.however when i trigger the idoc from an output type the extended segments are not populated.is there a way you can put a break point in the code.if that is