aspose file tools*
The moose likes Java in General and the fly likes Java Logging problem - created multiple files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Logging problem - created multiple files" Watch "Java Logging problem - created multiple files" New topic
Author

Java Logging problem - created multiple files

mozammil muzza
Ranch Hand

Joined: Dec 22, 2011
Posts: 32

Hi ALL,
I am working on application that need java feature i.e. java.util.logging for logging its messages.
But when i am trying to run my application it is creating several file e.g. <filename>.log, <filename>1.log, <filename>2.log etc


Please help me on this.
Thanks

Khuda Haafiz Muzza 4 Java
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11499
    
  16

I'm not sure anyone will be able to help you. You really haven't provided any information on how you are doing things. How are you using the logging? Do the multiple files get created on a single run, or do you get a new file each time you restart the program?

There are probably a million more questions I could ask, but the solution would be for you to provide a simple, self-contained example that demonstrates your problem.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Go get log4j, use it instead of the standard java.util.logging.

You can do it with the java.util library, but its much, much easier with log4j
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 859

It may be the logs are rolling over due to a very small setting.

So when filename.log fills up, it is copied to filenameN.log (where N was the last number used), and so on.

Without seeing your configuration, all we can do is speculate.

WP
mozammil muzza
Ranch Hand

Joined: Dec 22, 2011
Posts: 32

my bad for not describing query properly...

Please find code below :


Calling class (Main method class)



Aother two classes which are logged




and the output folder is :

./log/test.log
./log/test.log.1
./log/test.log.2
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18989
    
    8

If my calculations are correct, then one run of that program will produce eight lines of logging. So, which of those eight lines are in which of those three log files?
mozammil muzza
Ranch Hand

Joined: Dec 22, 2011
Posts: 32

Paul Clapham wrote:If my calculations are correct, then one run of that program will produce eight lines of logging. So, which of those eight lines are in which of those three log files?


Hi Paul,

Not in a single file all the eight lines are produced...
Log files are created very much based on classes.

means...some lines are in first log file, some are in other...like this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Logging problem - created multiple files