[logback-user] Issue with log files generation on MAC machines
Nikhil Diwan
nikhil.diwan at gmail.com
Tue Dec 7 18:13:32 CET 2010
Hi,
There seems issue with logback generating log files on MAC machines.
Instead of loggers creating log folder/log files log messages are being
displayed on console.
logback.groovy:-
import ch.qos.logback.classic.encoder.PatternLayoutEncoder
import ch.qos.logback.core.FileAppender
import ch.qos.logback.core.rolling.FixedWindowRollingPolicy
import ch.qos.logback.core.rolling.RollingFileAppender
import ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy
import static ch.qos.logback.classic.Level.DEBUG
def LOG_HOME = "/test/logback/logs"
def filePatternFormat = "%d %-5level %logger - %msg%n"
// Defining appender for root
appender('FILE', FileAppender) {
file = "${LOG_HOME}/root.log"
encoder(PatternLayoutEncoder) {
pattern = filePatternFormat
}
}
appender("MACLogback", RollingFileAppender) {
file = "${LOG_HOME}/MACLogback.log"
rollingPolicy(FixedWindowRollingPolicy) {
fileNamePattern = "MACLogback.%i.log.zip"
minIndex = 1
maxIndex = 10
}
triggeringPolicy(SizeBasedTriggeringPolicy) {
maxFileSize = "10MB"
}
encoder(PatternLayoutEncoder) {
pattern = filePatternFormat
}
}
logger 'MACLogback', DEBUG, ['MACLogback'], false
root DEBUG, ['FILE']
java file:-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MACLogback {
public static void main(String[] args) {
System.out.println("Before logging");
Logger logger = LoggerFactory.getLogger(MACLogback.class);
logger.debug("THIS IS FOR TESTING LOGBACK CONFIGURATION ON MAC!");
System.out.println("After logging");
}
}
I see log statements on CONSOLE as :
Before logging
11:07:24.309 [main] DEBUG MACLogback - THIS IS FOR TESTING LOGBACK CONFIGURATION
ON MAC!
After logging
ISSUE: Log file is not created under "/test/logback/logs" location, which is
expected.
Any thoughts??
More information about the Logback-user
mailing list