[logback-user] Elongated system startup-time because of Logback configuration

Nikhil Diwan nikhil.diwan at gmail.com
Tue Nov 23 08:39:59 CET 2010


> You still didn't mention whether there was any improvement.
Yes there is improvement in start-up time, if there is no logging using logabck
in my system.
> 
> Loggers don't require their own thread and don't create one. 25 loggers
shouldn't be a big deal.
> Can you send you logback.xml?

I am using "logbafck.groovy", see below:-

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
import static ch.qos.logback.classic.Level.INFO

scan('60 seconds')

// Defining flag on OS type 
def isWindows = System.getenv('OS').contains('Windows')

// Declaring default location for logging
def LOG_HOME = "C:/dvs/client/logs"

// Defining log file location for Non-Windows OS
if (!isWindows) {
    LOG_HOME = "/dvs/client/logs"
}

def filePatternFormat = "%d %-5level %logger - %msg%n"
def serviceList = [ "Service_1", "Service_2", "Service_3", "Service_4",
"Service_5", "Service_6",
                    "Service_7", "Service_8", "Service_9", "Service_10",
"Service_11",
                    "Service_12", "Service_13", "Service_14", "Service_15",
"Service_16",
                    "Service_17", "Service_18", "Service_19", "Service_20",
                    "Service_21", "Service_22", "Service_23", "Service_24",
                    "Service_25", "Service_26", "Service_27" ]

// Defining appender for root                    
appender('FILE', FileAppender) {
    file = "${LOG_HOME}/root.log"
    encoder(PatternLayoutEncoder) {
        pattern = filePatternFormat
  }
}

// Creating appenders for all services
for (service in serviceList) {
    appender("${service}", RollingFileAppender) {
        file = "${LOG_HOME}/${service}/${service}.log"     
        rollingPolicy(FixedWindowRollingPolicy) {
            fileNamePattern = "${LOG_HOME}/${service}/${service}.%i.log.zip"
            minIndex = 1
            maxIndex = 10
        }
        triggeringPolicy(SizeBasedTriggeringPolicy) {
            maxFileSize = "100MB"
        }
        encoder(PatternLayoutEncoder) {
            pattern = filePatternFormat
        }
    }
}

// Defining logger per service 
logger 'Control.Service_1', INFO, ['Service_1'], false
logger 'Control.Service_2', INFO, ['Service_2'], false
logger 'Build_Services.Service_3', INFO, ['Service_3'], false
logger 'Build_Services.Service_4', INFO, ['Service_4'], false
logger 'Build_Services.Service_5', INFO, ['Service_5'], false
logger 'Build_Services.Service_6', INFO, ['Service_6'], false
logger 'Build_Services.Service_7', INFO, ['Service_7'], false
logger 'Build_Services.Service_8', INFO, ['Service_8'], false
logger 'Build_Services.Service_9', INFO, ['Service_9'], false
logger 'Build_Services.Service_10', INFO, ['Service_10'], false
logger 'Build_Services.Service_11', INFO, ['Service_11'], false
logger 'Build_Services.Service_12', INFO, ['Service_12'], false
logger 'Build_Services.Service_13', INFO, ['Service_13'], false
logger 'Build_Services.Service_14', INFO, ['Service_14'], false
logger 'Build_Services.Service_15', INFO, ['Service_15'], false
logger 'Regression_Services.Service_16', INFO, ['Service_16'], false
logger 'Regression_Services.Service_17', INFO, ['Service_17'], false
logger 'Regression_Services.Service_18', INFO, ['Service_18'], false
logger 'Regression_Services.Service_19', INFO, ['Service_19'], false
logger 'Regression_Services.Service_20', INFO, ['Service_20'], false
logger 'Regression_Services.Service_21', INFO, ['Service_21'], false
logger 'Regression_Services.Service_22', INFO, ['Service_22'], false
logger 'Regression_Services.Service_23', INFO, ['Service_23'], false
logger 'Regression_Services.Service_24', INFO, ['Service_24'], false
logger 'Regression_Services.Service_25', INFO, ['Service_25'], false
logger 'Regression_Services.Service_26', INFO, ['Service_26'], false
logger 'Regression_Services.Service_27', INFO, ['Service_27'], false

root DEBUG, ['FILE']







More information about the Logback-user mailing list