LogLevel.INFO printed as ERROR [STDERR] in Jboss log, what is wrong?
I´ve been using MyEclipse to reverese engineer some database tables to EJBs. In this process, MyEclipse creates a class called LogUtil, which looks like this:
public class LogUtil {
private static final Logger logger;
static {
logger = Logger.getLogger("SupplierDatabaseEJBPU");
logger.setLevel(Level.ALL);
}
public static void log(String info, Level level, Throwable ex) {
logger.log(level, info, ex);
}
public static Logger getLogger() {
return logger;
}
}
It will then insert logging into a number of generated methods, for example:
public void save(PurchaseOrderInput entity) {
LogUtil.log("saving PurchaseOrderInput instance", Level.INFO, null);
try {
entityManager.persist(entity);
LogUtil.log("save successful", Level.INFO, null);
} catch (RuntimeException re) {
LogUtil.log("save failed", Level.SEVERE, re);
throw re;
}
}
I´m not that experienced with loggers, so maybe this is very easy...
When I run for example the method posted above, the following is what I get in my server.log.
2011-02-23 09:22:30,301 ERROR [STDERR] 2011-feb-23 09:22:28 se.ahlens.intranet.apps.supplierdatabase.LogUtil log
INFO: save successful
I find this very confusing. Is it supposed to look like this? I expected something alo开发者_运维问答ng:
2011-02-23 00:05:30,348 INFO [SupplierDatabaseEJBPU] INFO: save successful
It seems that two loggers are chained (the date is printed twice). Assumption: The first one is logging with level info to the console. Jboss intercepts the system output streams and logs them using its own logger (which uses the error level)
精彩评论