Results 1 to 6 of 6

Thread: log file

  1. #1
    cucucur is offline Member
    Join Date
    Apr 2011
    Posts
    20
    Rep Power
    0

    Default log file

    hi! I'm using java.util.logging to make a file with my log. This code works in Windows, but it doesn't in ubuntu (I need the ubuntu version):

    Java Code:
    	public static void logInit(){	
    		try {
    			FileHandler fh = new FileHandler("/home/tomcat6/log",true);
                fh.setFormatter(new SimpleFormatter());
                log = Logger.getLogger("/home/tomcat6/log");
    			log.addHandler(fh);
                log.info("example");
    		}
    		catch (IOException e) {
    		}
    	}
    It doesn't open the file log and continues writting on it, it start a new file called log.1, log.2, log.3... every time I execute this code.

    I have no idea how to solve it, could you help me?

    thanks in advance!!

  2. #2
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

    Default

    I guess your program has not access to this folder.
    You can try give access
    Java Code:
    chmod 777 log
    Skype: petrarsentev
    http://TrackStudio.com

  3. #3
    cucucur is offline Member
    Join Date
    Apr 2011
    Posts
    20
    Rep Power
    0

    Default

    thank you so much, but, I've already tried this.

    When the program creates a new file it is like this:

    Java Code:
    ubuntu@ubuntu:/home/tomcat6$ ls -l
    total 96
    -rw-r--r-- 1 tomcat6 tomcat6  64 2011-04-12 15:40 log
    -rw-r--r-- 1 tomcat6 tomcat6  64 2011-04-12 16:03 log.0
    It is in /home/tomcat6, i tried 777 to home, tomcat6 and log, but it didn't work!

    I can'd understand!

    Tnaks!

  4. #4
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    Quote Originally Posted by alma111 View Post

    What is the point of this?

  5. #5
    cucucur is offline Member
    Join Date
    Apr 2011
    Posts
    20
    Rep Power
    0

    Default

    Quote Originally Posted by pbrockway2 View Post
    What is the point of this?
    I don't understand it either...

    I want to create a new log file, I decide what to write, the log deffinition is not concern about my problem...

    Thank you anyway!!

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default

    Quote Originally Posted by pbrockway2 View Post
    What is the point of this?
    It's signature link spam, I've reported it.

    db

Similar Threads

  1. Replies: 1
    Last Post: 08-04-2010, 03:24 PM
  2. Replies: 0
    Last Post: 07-15-2010, 01:23 PM
  3. Replies: 8
    Last Post: 02-18-2010, 12:54 PM
  4. Replies: 0
    Last Post: 02-11-2009, 09:53 AM
  5. Replies: 7
    Last Post: 05-23-2008, 03:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •