Logging ignores {user.dir} ?

519 views
Skip to first unread message

Slim Slam

unread,
Mar 19, 2015, 3:44:59 PM3/19/15
to play-fr...@googlegroups.com
Logging works fine, but when I run in production (after "activator dist"), the application.log and access.log files, and associated archives,
just get put in the same directory I launched the app in (which is not even in the user directory hierarchy).  Is there
something I'm missing here?  I expect the logs to go in the same directory as the user who launched Play, and who
owns the files (user = fred, so /home/fred). 

<configuration>


   
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
   
<file>${user.dir}/application.log</file>
       
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
           
<!-- Daily rollover with compression -->
           
<fileNamePattern>${user.dir}/application-log-%d{yyyy-MM-dd}.gz</fileNamePattern>
           
<!-- keep 30 days worth of history -->
           
<maxHistory>30</maxHistory>
       
</rollingPolicy>
       
<encoder>
           
<pattern>%date{yyyy-MM-dd HH:mm:ss ZZZZ} [%level] from %logger in %thread - %message%n%xException</pattern>
       
</encoder>
   
</appender>


   
<appender name="ACCESS_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
   
<file>${user.dir}/access.log</file>
       
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
           
<!-- daily rollover with compression -->
           
<fileNamePattern>${user.dir}/access-log-%d{yyyy-MM-dd}.gz</fileNamePattern>
           
<!-- keep 30 days worth of history -->
           
<maxHistory>30</maxHistory>
       
</rollingPolicy>
       
<encoder>
           
<pattern>%message%n</pattern>
           
<!-- this quadruples logging throughput -->
           
<!-- immediateFlush>false</immediateFlush -->
       
</encoder>
   
</appender>


   
<!-- additivity=false ensures access log data only goes to the access log -->
   
<logger name="access" level="INFO" additivity="false">
       
<appender-ref ref="ACCESS_FILE" />
   
</logger>


   
<root level="INFO">
       
<appender-ref ref="FILE"/>
   
</root>


</configuration>

Slim Slam

unread,
Mar 21, 2015, 6:36:47 PM3/21/15
to play-fr...@googlegroups.com
I see in the 2.4 docs that {user.dir} is defined as:

# The root directory for the Play server instance. This value can
# be set by providing a path as the first argument to the Play server
# launcher script.

So, I guess things are working correctly. Why you would call the root directory "user.dir" instead of "root.dir", or something like that, is
left as an exercise for the reader.  I assumed that user.dir was the home directory of the user that launches play. 

J

Naftoli Gugenheim

unread,
Mar 22, 2015, 4:32:55 PM3/22/15
to play-fr...@googlegroups.com

user.dir is a system property defined by Java, that contains the current working directory (at the time the JVM was launched).


--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Slim Slam

unread,
Mar 22, 2015, 8:12:02 PM3/22/15
to play-fr...@googlegroups.com
Ok. That makes sense. Then "user.home" is the user's home directory. Maybe the docs
could also add that one sentence:  "user.dir is a system property defined by Java that contains the current working directory"

J

Naftoli Gugenheim

unread,
Mar 23, 2015, 8:02:35 PM3/23/15
to play-fr...@googlegroups.com

You can send a PR...

Reply all
Reply to author
Forward
0 new messages