This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with logging

 
Mike Semlitsch
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
John Stone
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Mike Semlitsch
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 332
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!

The default settings of the "logging.properties" were the reason. Using a FileHandler shows every log entry.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic