I’m using log4j library in my Java Spring Project
When I run my web app on my local Windows machine everything goes ok.
When I deploy my application to Digital Ocean Ubuntu server I get runtime error which I can’t fix
logj4.properties file which I use for windows and everything runs ok
log4j.rootLogger=INFO, file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=C:\\TMP\\log_file.log
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
and logj4.properties file which I use for ubuntu and get runtime error
log4j.rootLogger=INFO, file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=tmp/log_file.log
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
ERROR
log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: TMP/log_file.log (Permission denied)
the application successfully creates empty log_file.log which is available for modifications from console and than the whole app crashes
No idea whether Digital Ocean even allows writing logs to arbitrary location
will appreciate much you advise
thank you
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
This question was answered by @VadOs:
solution is very simple as it often happens )) never put your app compiled with jdk 8 on tomcat 7 server )) thanks again. issue closed
solution is very simple as it often happens )) never put your app compiled with jdk 8 on tomcat 7 server )) thanks again. issue closed