exomiser / Exomiser

A Tool to Annotate and Prioritize Exome Variants
https://exomiser.readthedocs.io
GNU Affero General Public License v3.0
190 stars 54 forks source link

Exomiser logs to /tmp/spring.log, causing clashes in shared user environments #541

Closed oneillkza closed 4 months ago

oneillkza commented 4 months ago

We've been having the following issue come up. From the exomiser log file:

Logging system failed to initialize using configuration from 'null'
java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - openFile(/tmp/spring.log,true) call failed. java.io.FileNotFoundException: /tmp/spring.log (Permission denied)

It looks like spring is trying to create and write to /tmp/spring.log, but /tmp is a shared location on our servers, so this creates clashes if multiple users are running it at the same time, or if one user ran it and the file got created with RO permissions for other users.

It sounds like other people have noticed this, and just work around it:

https://www.lbgi.fr/VaRank/Documentation/README.VaRank_latest.pdf

Moreover, the Exomiser module writes in the /tmp/spring.log file that must therefore have write permissions.

Going around and creating /tmp/spring.log on every server and giving it write permissions to everyone is a very hacky solution. The right solution would be to specify this explicitly in logback-spring.xml, ie:

<property name="LOG_PATH" value="./"/>

(Probably "./" would be a reasonable default location.)

Another way to solve this would be to expose the spring logging location as a command-line parameter.

Note that this created a very Byzantine error for us, where a student developed a workflow, but when passed on to a staff member, it just would not run, because on most of our servers the student had already run exomiser, thereby creating /tmp/spring.log, and blocking anyone else from running exomiser on that server.

julesjacobsen commented 4 months ago

Hi @oneillkza, sorry you're struggling with this. Exomiser uses Spring boot to help with these things, so you can fix it easily. The spring boot logging configuration docs can be found here: https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.logging

I agree that the default writing out of a file to /tmp isn't ideal, so you fix this by changing the logging file to be written to a file of your choice by un-commenting the line at bottom of the application.properties file:

### logging ###
## either uncomment this to write the log to logs/exomiser.log
#logging.file.name=logs/exomiser.log

or add this line to the application.properties

### logging ###
logging.config=logback-spring.xml

and ensure the file logback-spring.xml (or whatever you want to call it) is in the same directory as the exomiser-cli.jar. The logback-spring.xml file should contain the following configuration:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/defaults.xml" />
    <include resource="org/springframework/boot/logging/logback/console-appender.xml" />
    <include resource="org/springframework/boot/logging/logback/file-appender.xml" />
    <root level="INFO">
        <appender-ref ref="CONSOLE" />
        <appender-ref ref="FILE" />
    </root>
    <logger name="com.zaxxer.hikari" level="ERROR"/>
</configuration>

I'll change this so that the xml configuration above is the default in the next release.

oneillkza commented 4 months ago

Thanks! I think that should allow us to get around this for now.

oneillkza commented 4 months ago

I'd add that we run this in a containerised workflow, so for us we'd need to add a line in the Dockerfile to edit the application.properties. It would definitely be easiest if it were just an option that could be supplied at runtime.

julesjacobsen commented 4 months ago

You can supply this at runtime too - just add --logging.config=logback-spring.xml to your arguments list after all of the exomiser specific commands.

Actually Spring should automatically pickup the logback-spring.xml from the filesystem first if it's in the same directory as the exomiser-cli-{version}.jar, so you shouldn't need to change any application.properties or commands.