Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In your above log4j configuration you are creating a <a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/ConsoleAppender.html" rel="nofollow">ConsoleAppender</a> which logs all your messages to standard out. Which is the same location as the System.out.println() calls. Now when you created the 2nd Appender (<a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/FileAppender.html" rel="nofollow">FileAppender</a>) you are no longer writing to standard out, but now writing to file.</p> <p>I would suggest changing your system.out.println() calls to use <a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Logger.html" rel="nofollow">Log4j</a> calls [error(), info(), debug() etc..]</p> <pre><code>public class MyClass{ private static Logger logger = Logger.getLogger(MyClass.class); public MyClass(){ logger.debug("Hello World"); } } </code></pre> <p>By doing this you wont be mixing and matching your log4j with your standard out calls and then can configure your application as needed between console and file writing. A good benefit to using a Logger over the System.out calls is that they are configurable at runtime and can log messages at various levels.</p> <p><strong>Edit as per comments</strong></p> <p>Tomcat by default logs the stdout messages to <code>%tomcat_home%/logs/catalina.out</code> (name may differ slightly per tomcat specs) Tomcat uses a logging framework called <a href="http://tomcat.apache.org/tomcat-6.0-doc/logging.html" rel="nofollow">JULI</a> to performs its basic logging operations. If you simply want the log to be written somewhere else then the tomcat folder, you can do that by editing the file %tomcat_home/conf/logging.properties</p> <p>Another scenario you may want to tackle is redirecting the stdout completely. This is frowned upon but can be done. If you look at the file catalina.bat (or .sh in unix) you will see the startup option of LOGGING_MANAGER which will override the default JULI implementation. I have never used this option so you would need to research it in more depth. To understand JULI more read Apache's <a href="http://wiki.apache.org/tomcat/FAQ/Logging" rel="nofollow">Wiki article</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload