This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes java.util.Logger creating multiple log 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.util.Logger creating multiple log files" Watch "java.util.Logger creating multiple log files" New topic

java.util.Logger creating multiple log files

Anant Jagania
Ranch Hand

Joined: Oct 20, 2004
Posts: 49

I created a My Logger class which holds object of java.util.Logger and in the constructor i am adding FileHandler to Logger.

Now this logger i used in all my class for logging purpose.

It seems that it is creating new new log files every time. When I run the my application it creates three log files at the same time.

Please let me know how to over come this.

David Newton

Joined: Sep 29, 2008
Posts: 12617

I think it'd make sense to post the actual code (and configuration, if any) you're using.
Anant Jagania
Ranch Hand

Joined: Oct 20, 2004
Posts: 49
Here is the code

Pat Farrell

Joined: Aug 11, 2007
Posts: 4659

If you are having to change your code to make it work the way you like, I suggest you take a quick look at Apache's log4j

It is widely used, more flexible, and there is an active support mailing list.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: java.util.Logger creating multiple log files
jQuery in Action, 3rd edition