• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to stop printing log in console?

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

i'm currently doing a code enhancement on a java program by using eclipse

the previouse version has used logger, and i have no idea how to use log at all....

so I've commanded off the log lines,

however, when i run the program, the program prints many log messages
something like this:


log4j: reset attribute= "false".
log4j: Threshold ="null".
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [gic.dpms] additivity to [true].
log4j: Class name: [org.apache.log4j.rolling.RollingFileAppender]
log4j: Setting property [immediateFlush] to [false].
log4j: Setting property [fileNamePattern] to [/opt/pgadev/log/pegasus.log.%d].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"

I'm wondering is there anyway to stop printing the log4j message?
any help will be much appreciated, thanks
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check in log4j.properties whether stdout is configured
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it me or is that kind of wrong . You don't get how to logger works so you comment the logging statements, wouldn't learning how to logger works be a much better solution?
 
sze sze chan
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Wouter Oet wrote:Is it me or is that kind of wrong . You don't get how to logger works so you comment the logging statements, wouldn't learning how to logger works be a much better solution?



Hi,
I've tried to do research on logging and the properties set up thing kind of confuse me.
this program did not used the normal log4 jar or properties, the previous developer wrote a log4j.xml and log4j.dtd himself.
And sadly I can't figure out how does that two file function when I still very confuse with the basic logging thing. The previous developer didn't really give me much information...
And I did spent few days on that, it always tells me something like log4j properties is not configured. and I tried reinstall all plugins in a new package, it gives me this

The project deadline is just in few days and I still have many many other things to work on, those documentation, user guide, and the Linux thing.

It's all very very very new to me.So I've decided to spend my time on more urgent work.

And I'm not sure if the logging message will be printed when it runs on Unix? So I've tried to comment off the logging and hopefully it won't come out there .... I cant test it out because I still have the problem with class path setting on Unix.

Anyway, I will appreciate it if you could provide any suggestion based on this problem. thanks
 
Ranch Hand
Posts: 326
Android Mac OS X Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, to be honest but somewhat rude, you have a RTFM-problem. And the most that we could do here is to re-write the manual found at http://logging.apache.org/log4j/1.2/manual.html.

The description for the Log4J-XML configuration format is found at http://wiki.apache.org/logging-log4j/Log4jXmlFormat.

The log4j.properties or log4j.xml must be found at the root of a classpath entry. If you take a look at http://www.vaannila.com/log4j/log4j-xml-configuration.html you can see how to load a configuration file programmatically.

To point out the file from the java-command, you use the -D flag, as in -Dlog4j.configuration=log4j.xml.

If you are using Tomcat, you need to put that in the CATALINA_OPTS either as a system variable of in the startup script.
reply
    Bookmark Topic Watch Topic
  • New Topic