wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Problem with logging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Problem with logging" Watch "Problem with logging" New topic
Author

Problem with logging

Mike Semlitsch
Greenhorn

Joined: Sep 30, 2007
Posts: 8
Hello Ranchers,

I have a basic problem with logging. My TestClass containing the main method does logging well. An object of my TestedClass which is created from the TestClass doesn't log anything, why?



Thanks for any help.


Mike Semlitsch<br />SCJD (URLyBird in progress...)<br />SCJP<br />LPIC-1
John Stone
Ranch Hand

Joined: May 04, 2007
Posts: 332
Well, I can see both messages with code you posted.
You can try to flush logger at the end of main method.
Musab Al-Rawi
Ranch Hand

Joined: Aug 06, 2007
Posts: 231
Hi,

this topic has been asked before. you need to create a FileHandler . Example:



you can set formatter and other properties as well.

hope that helps.

[ September 30, 2007: Message edited by: Musab Al-Rawi ]
[ September 30, 2007: Message edited by: Musab Al-Rawi ]

SCBCD - SCWCD - SCJD - SCJP - OCA
Mike Semlitsch
Greenhorn

Joined: Sep 30, 2007
Posts: 8
Thanks for your answers.

You are right John! I've tested the classes I posted and it works. :-)

I've reduced the lines of code of the classes but I've made a mistake. In the TestedClass I use 'myLogger.finer("Finer-Info from Logger")' and this finer logging doesn't work, although I set the Log-Level to 'Level.ALL' in the TestClass.
[ September 30, 2007: Message edited by: Mike Semlitsch ]
John Stone
Ranch Hand

Joined: May 04, 2007
Posts: 332
By default, console output starts from.. INFO (I guess).

try


or edit $JRE_HOME/lib/logging.properties file in your JRE directory.
[ September 30, 2007: Message edited by: John Stone ]
Mike Semlitsch
Greenhorn

Joined: Sep 30, 2007
Posts: 8
Thank you!

The default settings of the "logging.properties" were the reason. Using a FileHandler shows every log entry.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with logging
 
Similar Threads
Logging to one file from multiple java files
Good logging system for WebApp (Struts)
Unable to log ..
Logging level question
NX:Help on Logging messages unusual output