Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to change colour of logging output log4j
    primarykey
    data
    text
    <p>I'm currently working on a Java project and we are using logging. When a Log is made it is always printed in plain black text, whatever the logging level (INFO, ERROR, etc.)</p> <p>How can I override the colour of these outputs so for example all ERROR logs will be red while all WARN logs will be orange etc.</p> <p>Thanks</p> <p>EDIT: I managed to download the ANSIColorLayout file and my log4j.properties now refers to it. However I get the following errors:</p> <pre><code>log4j:WARN No such property [all] in org.apache.log4j.ConsoleAppender. log4j:WARN No such property [reset] in org.apache.log4j.ConsoleAppender. log4j:WARN No such property [stacktrace] in org.apache.log4j.ConsoleAppender. log4j:WARN No such property [info] in org.apache.log4j.ConsoleAppender. log4j:WARN No such property [error] in org.apache.log4j.ConsoleAppender. log4j:WARN No such property [defaultcolor] in org.apache.log4j.ConsoleAppender. </code></pre> <p>My log4j.properties file looks like this:</p> <pre><code>log4j.rootLogger = DEBUG, CA, FA log4j.appender.CA = org.apache.log4j.ConsoleAppender log4j.appender.CA.layout = balle.logging.ANSIColorLayout log4j.appender.CA.layout.ConversionPattern=%-5p [%d{MM-dd-yyyy HH:mm:ss}] %c - %m%n log4j.appender.CA.all=\u001B[1;37m log4j.appender.A1.fatal=\u001B[1;31m log4j.appender.CA.error=\u001B[0;31m log4j.appender.A1.warn=\u001B[1;33m log4j.appender.CA.info=\u001B[0;37m log4j.appender.A1.debug=\u001B[0;36m log4j.appender.CA.reset=\u001B[1;37m log4j.appender.CA.stacktrace=\u001B[0;31m log4j.appender.CA.defaultcolor=\u001B[1;37m </code></pre> <p>My guess is that I'm supposed to use my own custom ConsoleAppender? Does anyone have any ideas?</p> <p>Thanks</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.
 

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