Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Logging problem - created multiple files

 
mozammil muzza
Ranch Hand
Posts: 32
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12097
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 859
Chrome IBM DB2 Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20950
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic