Announcement Announcement Module
Collapse
No announcement yet.
SpringDM 1.0.2 - SLF4j and log4j - PatternLayout Configuration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SpringDM 1.0.2 - SLF4j and log4j - PatternLayout Configuration

    Hi Gurus,

    Requiremnet: Deploy a non-osgi (war) bundle on springdm and use slf4j for logging.

    For the above i have added the required jars in my bundle war WEB-INF/lib
    (http://forum.springsource.org/showthread.php?t=42249)

    And updated the WEB-INF/web.xml as shown below
    Code:
      <context-param>  
    		<param-name>log4jConfigLocation</param-name>  
    		<param-value>file:${sdm.configuration.home}/environment.properties</param-value>
    	</context-param>
    	<listener>
            <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
        </listener>
    And environment.properties
    Code:
    log4j.rootLogger=DEBUG, stdout, rollingFile
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
    log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
    log4j.appender.rollingFile.File="../logs/DateNode/trace
    log4j.appender.rollingFile.MaxFileSize=10MB
    log4j.appender.rollingFile.MaxBackupIndex=10
    log4j.appender.rollingFile.layout=org.apache.log4j.PatternLayout
    log4j.appender.rollingFile.layout.ConversionPattern=%d{ABSOLUTE} | %5p | %c | %C{1} | %m |%X{clientNumber}%n
    log4j.appender.rollingFile.Encoding=UTF-8
    With the above configuration log is generated as per the above ConversionPattern. But on linux it's not.

    Any idea how to override this on Linux.
    BTW server.config:
    Code:
    {
    	"serviceability": {
    	    "trace": {
    	        "directory": "../logs/DateNode/trace",
    	        "levels": {
    	            "*" : "info"
    	        }
    	    },
    	    "logs": {
    	        "directory": "../logs/DataNode/logs"
    	    },
    	    "dump": {
    	        "directory": "../logs/DataNode/dump"
    	    }
    	},
    	"pickupDirectory" : "pickup",
    	"workDirectory": "work",
    	"configPaths": [
    	    "config"
    	],
    	"osgiConsole": {
    	    "enabled": false,
    	    "port": 2401
    	}
    }
    Thanks,
    Sharath

  • #2
    FYI..

    The above configuration is working fine on Linux too. We need not update the server.config file. Just specify the log location in log4j/env.properties.

    Cheers

    Comment

    Working...
    X