Home > Back-end >  Log4j logging test is normal, only after the deployment server startup to generate a log file, in th
Log4j logging test is normal, only after the deployment server startup to generate a log file, in th

Time:11-25

As title, I hope the effect is the log at the end of the day of the day, automatically generate a has the date for the suffix of log files, the second day of the log writes a new file, my configuration is as follows:
Log4j. RootLogger=the debug console, D, E,

Log4j. Logger. Java, SQL Connection=DEBUG
Log4j. Logger. Java, SQL Statement=DEBUG
Log4j. Logger. Java, SQL PreparedStatement=DEBUG

Log4j.logger.com.apache.ibatis.datasource.DataSourceFactory=DEBUG
Log4j.logger.com.apache.ibatis.jdbc.ScriptRunner=INFO

Log4j. Appender. The console=org. Apache. Log4j. ConsoleAppender
Log4j. Appender. Console. Layout=org.. Apache log4j. PatternLayout
Log4j. Appender. Console. Layout. ConversionPattern 5 p=% % d {MM - dd yyyy - HH: MM: ss} [% t] - % m % n


# # # # # # the DEBUG
Log4j. Appender. D=org. Apache. Log4j. DailyRollingFileAppender
Log4j. Appender. D.F ile=../logs/epass/log. The log
Da ppend log4j. Appender.=true
Log4j. Appender. Which hreshold=DEBUG
Log4j. Appender. D.l ayout=org.. Apache log4j. PatternLayout
Log4j. Appender. D.D atePattern='- dd yyyy - MM
Log4j. Appender. D.l ayout. ConversionPattern - d=% {MM - dd yyyy - HH: MM: ss} [% t: % r] - [p] % % m % n


# # # # # # ERROR
Log4j. Appender. E=org. Apache. Log4j. DailyRollingFileAppender
Log4j. Appender. E.F ile=../logs/epass/error log
Log4j. Appender. E.A ppend=true
Log4j. Appender. E. hreshold=ERROR
Log4j. Appender. E.l ayout=org.. Apache log4j. PatternLayout
Log4j. Appender. E.D atePattern='- dd yyyy - MM
Log4j. Appender. E.l ayout. ConversionPattern - d=% {MM - dd yyyy - HH: MM: ss} [% t: % r] - [p] % % m % n


# log4j.logger.org.springframework=off
Log4j.logger.org.apache.ibatis=off
Log4j.logger.com.alibaba.dubbo=off


As a result, the local test, manual modification time, the application can be segmentation and generate log files by date, but after deployment to win2008 server, application startup only generates a file, the daily logs are appended to the log file,
Beg god for help,

CodePudding user response:

No one in? Pray god help

CodePudding user response:

Have the person had the same situation

CodePudding user response:

See if there is something wrong with the file path and whether has the authority to write files

CodePudding user response:

Your log file name is dead, of course, there is only one file

CodePudding user response:

Solve the building Lord, you and I encounter problems, and, when I was at the local, to run in one of the tomcat, manually modify time will generate a log file, but not in another, so log4j configuration should be no problem, should be a tomcat and environmental problems, but I just can't find, according to the various methods are tried in the baidu, or not, the original poster is how to solve?

CodePudding user response:

reference 4 floor qq_21525397 response:
your log file name is dead, of course there is only one file



Look at the official document, should be very good solve this problem

CodePudding user response:

reference 5 floor baidu_34655578 reply:
solution, building Lord, I and you meet problems, and, when I was at the local, to run in one of the tomcat, manually modify time will generate a log file, but not in another, so log4j configuration should be no problem, should be a tomcat and environmental problems, but I just can't find, according to the various methods are tried in the baidu, or not, the original poster is how to solve?


Did you solve it? I also met,,,

CodePudding user response:

Find out whether have multiple log4j configuration file

CodePudding user response:

refer to the eighth floor zssazrael response:
to look whether have multiple log4j configuration file


Just one, I doubt that is the server problem, but this is related to what permissions?
I am their applications on the server, the user is administrator, should do not have what the permissions problem???????

CodePudding user response:

Windows or Linux

The directory permissions?
./logs/epass/

CodePudding user response:

I also met the same problem, the great god what's the solution?
My log4j configuration file is as follows:
Log4j. RootLogger=info, stdout, I, E

# # # \ u8F93 \ u51FA \ u5230 \ u63A7 \ u5236 \ u53F0 # # #
Log4j. Appender. Stdout=org. Apache. Log4j. ConsoleAppender
. Log4j appenders. Stdout. Target=System. Out
Log4j. Appender. Stdout. Layout=org.. Apache log4j. PatternLayout
Log4j. Appender. Stdout. Layout. ConversionPattern 5 p={ABSOLUTE} % d % % c {1} : % L - % m % n

Log4j. Appender. I=org. Apache. Log4j. DailyRollingFileAppender
Log4j. Appender. I.F ile=D: \ \ logs \ \ BDSH \ \ info log
Log4j. Appender. I.D atePattern='_' yyyy - MM - dd 'log'
Log4j. Appender. I.A ppend=true
Log4j. Appender. I.T hreshold=INFO
Log4j. Appender. I.l ayout=org.. Apache log4j. PatternLayout
Log4j. Appender. I.l ayout. ConversionPattern - d=% {MM - dd yyyy - HH: MM: ss} [% t: % r] - [p] % % m % n

Log4j. Appender. E=org. Apache. Log4j. DailyRollingFileAppender
Log4j. Appender. E.F ile=D: \ \ logs \ \ BDSH \ \ the error log
Log4j. Appender. E.D atePattern='_' yyyy - MM - dd 'log'
Log4j. Appender. E.A ppend=true
Log4j. Appender. E. hreshold=ERROR
Log4j. Appender. E.l ayout=org.. Apache log4j. PatternLayout
Log4j. Appender. E.l ayout. ConversionPattern - d=% {MM - dd yyyy - HH: MM: ss} [% t: % r] - [p] % % m % n


Log4j.logger.com.springframework=DEBUG
Log4j.logger.com.mybatis=DEBUG
Log4j.logger.com.mybatis.common.jdbc.SimpleDataSource=DEBUG
Log4j.logger.com.mybatis.common.jdbc.ScriptRunner=DEBUG
Log4j.logger.com.mybatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
Log4j. Logger. Java, SQL Connection=DEBUG
Log4j. Logger. Java, SQL Statement=DEBUG
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related