| |

VerySource

 Forgot password?
 Register
Search
View: 819|Reply: 1

How to use log4j to make the log into several files by thread name to record the log of each thread? java

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-3-18 10:30:02
| Show all posts |Read mode
How to use log4j to make the log into several files by thread name to record the log of each thread?
Can you? ? ?
Is there any reference material?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-21 16:00:02
| Show all posts
solution:
1. create several "log4j.properties"(They can have different names), in which we can define different files.
2. In the thread which needs different log file, add this at first:
PropertyConfigurator.configure("thread1\\loginLOG.properties");
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list