简体   繁体   中英

Changing the System.out.println output destination for a specific web application on WAS 7

I have very big java web applications deployed on IBM Websphere 7 and all of the exception catching blocks uses System.out.println to log the exceptions, all the output of System.out.println of the all applications deployed on WAS profile is printed in WAS SystemOut.log file.

I need to make every application on WAS log to a different log file not to SystemOut.log.

Log4j is not integrated with the applications and enabling it will take a long time.

Is there any technique to change the output destination of System.out.println for each application on WAS?

all of the exception catching blocks uses System.out.println to log the exception

Don't do this! Use a logging framework.

Log4j is not integrated with the applications and enabling it will take a long time.

Well, then find the guy who build such a crappy application and make him implement the necessary changes.

in this answered thread, the solution depends on overriding the out object of the System class to make use the log4j appender and i think its a nice idea

StdOutErrLog

正如对您的问题的评论所指出的那样,您可以更改 System.out 和 System.err 在全球范围内的位置,但是如果您想在每个应用程序的基础上进行更改,我能想到的唯一解决方案是使用AOP 框架(如 AspectJ)拦截相关类中的所有 println 调用,并将它们定向到特定于相关类的记录器。

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