Reputation: 33605
i am using logback 1.0.0 and i have inside my application on root folder named logs and it contains a log file named mypp.log and my logback.xml configuration is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>[%thread] %-5level %logger{36} - %msg%n</pattern>
</layout>
</appender>
<!--Daily rolling file appender -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>logs\myapp.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<FileNamePattern>logs\logFile.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>50MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>[%thread] %-5level %logger{36} - %msg%n</pattern>
</layout>
</appender>
<logger name="com.myapp">
<level value="debug" />
</logger>
<root>
<level value="error" />
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration>
it logs fine to console, but it doesn't log to file, unless i change the file path to be absolute please advise how to fix this issue.
Upvotes: 1
Views: 5145
Reputation: 33605
my misunderstanding, the log folder and file was created successfully inside the bin folder of jboss.
Upvotes: 1