Is a single logback.xml file for multiple applications a good practice?

Several applications have been deployed to my Tomcat server.

First, each had one logback.xml file, packed in WEB-INF/classes with it.

Then I placed another directory outside the Tomcat deployment directory in the common class path, placed one logback.xml and excluded the others from the applications. The reason for this was that I wanted the registration to be convenient for setting up in one place.

Unfortunately, now it is necessary to register each application in its own file.

Since I think this is not so easy to achieve with this setting, I wonder if this setting is really good. What do you think?

+6
source share
3 answers

Unfortunately, now it is necessary to register each application in its own file.

I think this is the only right way to do this. It is enough to have several log files for one application, but for many applications written in one log to be bad practice.

+2
source

What you want to do to have one configuration file is SiftAppender .

+2
source

LOGS is easy to read and easy to parse by any user. If you have one log file in which several applications are written to the same file, you can intercept different log entries. Since you are a developer who has knowledge of all 7 applications that you could get, but it will be difficult for a new developer to understand the logs. Logs should be concise and easy to decipher, so support problems can be analyzed simply by analyzing log entries.

I suggest you follow these tips

+1
source

All Articles