VadOs
By:
VadOs

I need to solve my java web app file io issue

December 4, 2015 1.1k views
Java Logging Applications Ubuntu

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

1 comment
  • solution is very simple as it often happens )) never put your app compiled with jdk 8 on tomcat 7 server )) thanks again. issue closed

1 Answer

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

View the original comment

Have another answer? Share your knowledge.