I am trying to implement the feature from this link, How to redirect stdout and stderr writing to a log4j appender | SysGears and I need some help with it, please.
I have compiled the class successfully. The author of the article failed to mention what classes need to be imported and I had to figure that out the hard way, as it took me some time to deduce this. In the next step, the author states to use the class, write the following:
Wonderful. I have a question, though? What does this even mean? Where do I write it? In the same file as the class was declared? In a different file? What should the import declarations be? What would be the full java file, everything included?Code:
System.setErr(new PrintStream(new LoggingOutputStream(
System.err, Logger.getLogger("outLog"), Level.ERROR)));
If somebody can help me, I would appreciate it. Thank you.