• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Problem with logging

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you!

The default settings of the "logging.properties" were the reason. Using a FileHandler shows every log entry.
 
All that thinking. Doesn't it hurt? What do you think about this tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic