I am very new to log4j. I don't want to show the exception stack trace in my log file, for example
java.lang.IllegalArgumentException: nodeRef is a mandatory parameter
at org.alfresco.util.ParameterCheck.mandatory(ParameterCheck.java:42)
These exceptions are written directly to the console using e.printStackTrace()something like this.
try {
} catch(Exception e) {
StringWriter stack = new StringWriter();
e.printStackTrace(new PrintWriter(stack));
logger.debug("Caught exception; decorating with appropriate status template : " + stack.toString());
}
Now I am setting up an open source project without writing all my programs myself. Thus, it is impossible to delete e.printStackTrace();in all java files.
As far as I know, a log that is printed log4jusing a log can be configured using the log4j error level, such as information, debug, warn.But, how to write directly to the console or file?
log4j, stacktrace, ? ?