简体   繁体   中英

Sending System.out to a file and Commons Logging

I am using commons logging:

  private static final Log LOG = LogFactory.getLog(MyClass.class);

Why those logs doesn't go into the log file when I run

sh Main 2>&1 > logfile

I am using the default properties and no log4j.properties are in the classpath.

You have the redirections backwards. They're processed from left to right. Try this:

sh Main > logfile 2>&1 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM