log4j2-in-tomcat icon indicating copy to clipboard operation
log4j2-in-tomcat copied to clipboard

Logs such as System.out after log4j2-tomcat.xml are configured can only be output in localhost.xxxx-XX-xx.log

Open AureliusPatiens opened this issue 5 years ago • 10 comments

I have a log4j2-tomcat.xml file, which is based on your article and the Github project. It works exactly the same and can generate a file every day, but the System.out logs are all printed to localhost.2019-09- 12.log file, this is not what I want. I tried to modify the log4j2-tomcat.xml file, and referenced the log4j2 document and other blog related configuration, it does not take effect, can I output the log such as System.out Go to the place I want and modify the file name instead of just printing it to the localhost.2019-09-12.log file. I look forward to hearing from you, thank you very much. September 12, 2019.

AureliusPatiens avatar Sep 12 '19 09:09 AureliusPatiens

Tomcat 9.0.20 log4j2 2.12.1

AureliusPatiens avatar Sep 12 '19 09:09 AureliusPatiens

Hello @xiaonanhailili ,

Glad to hear that the repo is kind of useful :+1:

mmm, :thinking: , in the provided configuration there is no LOCALHOST appender, so that file should not exist. Can you share with me your current log4j2-tomcat.xml?

Regarding the System.out, I am not sure what you want to achieve. In my case I want to keep the catalina.out (standard output of the tomcat/docker process) in this case as cleaner as possible.

Hope it helps,

Luis

lurodrig avatar Sep 12 '19 10:09 lurodrig

Hello, Luis,Thank you for your reply. I am uploading my entire Tomcat package to Github, I am in China, uploading is very slow, please forgive me.

AureliusPatiens avatar Sep 12 '19 10:09 AureliusPatiens

log4j2-tomcat.txt This is my log4j2-tomcat.xml:

AureliusPatiens avatar Sep 12 '19 10:09 AureliusPatiens

I put my Tomcat environment here. https://github.com/xiaonanhailili/tomcat_backup That is compressed in 7z format. I hope to help you understand my mistakes.

AureliusPatiens avatar Sep 12 '19 10:09 AureliusPatiens

Regarding the System.out, I am not sure what you want to achieve. In my case I want to keep the catalina.out (standard output of the tomcat/docker process) in this case as cleaner as possible.

Keeping it clean is also what I hope. But I think the log output to the localhost file is incorrect. I want to output it to the tomcat9-stdout file or I can customize a file. That's great.

AureliusPatiens avatar Sep 12 '19 10:09 AureliusPatiens

Hello @xiaonanhailili

May I ask you to remove your conf/logging.properties and give it a try?

Hope it helps,

Luis

lurodrig avatar Sep 12 '19 10:09 lurodrig

hello @lurodrig yes, I can try again and give you feedback. I have tried to do this, after which the local host file will not be generated.

plum

AureliusPatiens avatar Sep 12 '19 10:09 AureliusPatiens

hello,Luis @lurodrig I am trying to delete CONF / logging.properties This is feedback

TIM截图20190912183124 TIM截图20190912183118

AureliusPatiens avatar Sep 12 '19 10:09 AureliusPatiens

This problem has plagued me for a day. I have been trying to find a solution, but I have not succeeded, so I will ask you if you have encountered such a situation.

AureliusPatiens avatar Sep 12 '19 10:09 AureliusPatiens