Contact log4j soon before, in the Java Engineering Test study, everything is normal.
A few days ago in a JSP case, Web engineering, the same configuration file, but can not write files.
The normal output in the console log.
Web Engineering, the Java class in the Main method test, you can write the file, the console is also normal.
After repeated testing, the problem is on the path.
The previously used configuration file uses a relative path, and the log output is normal after the absolute path is replaced.
The configuration using an absolute path is as follows, and can be used properly under Web engineering:
<?xml version= "1.0" encoding= "UTF-8"?> <configuration status= "error" > <appenders> <con Sole name= "Console" target= "System_out" > <thresholdfilter level= "Trace" onmatch= "ACCEPT" DEN Y "/> <patternlayout pattern="%d{hh:mm:ss. SSS}%-5level%class{36}%l%m-%msg%xex%n "/> </Console> <file name=" log "filename=" f:/edu Tohome/edutohome/log/test.log "append=" false "> <patternlayout pattern="%d{hh:mm:ss. SSS}%-5level%class{36}%l%m-%msg%xex%n "/> </File> <file name=" ERROR "Filename=" f:/edutohome/
Edutohome/logs/error.log "> <thresholdfilter level=" error "onmatch=" ACCEPT "onmismatch=" DENY "/> <patternlayout pattern= "%d{yyyy. Mm.dd ' at ' HH:mm:ss z}%-5level%class{36}%l%m-%msg%xex%n '/> </File> <rollingfile name= ' R
Ollingfile "Filename=" F:/edutohome/edutohome/logs/web.log " filepattern= "f:/edutohome/edutohome/logs/$${date:yyyy-mm}/web-%d{mm-dd-yyyy}-%i.log.gz" > <P Atternlayout pattern= "%d{yyyy-mm-dd ' at ' HH:mm:ss z}%-5level%class{36}%l%m-%msg%xex%n"/> <sizebase Dtriggeringpolicy size= "10MB"/> </RollingFile> </appenders> <loggers> &l T;root level= "Trace" > <appender-ref ref= "rollingfile"/> <appender-ref ref= "Console"/&G
T <appender-ref ref= "ERROR"/> <appender-ref ref= "log"/> </root> </loggers> </conf Iguration>