This discussion is archived
1 Reply Latest reply: Mar 22, 2013 6:13 AM by user639604 RSS

2 Log files in Coherence

932792 Newbie
Currently Being Moderated
Hi,

I have created a simple application in Java and it is running in the Coherence server.
I am using log4j in my code and when I deploy it in the server I want to have two log files.

First log file will contain all the log messages from my code.
Second long file will contain all the server related information (server started, operation in progress, and coherence server stopped)

I have 2 different property files and in my tangosol-coherence-override.xml , under the <logging-config> tag

<logging-config>
<destination>log4j</destination>
<severity-level>3</severity-level>
<message-format>{date} Oracle Coherence {version} {level} (thread={thread}, member={member}): {text} </message-format>
<character-limit>10000</character-limit>
</logging-config>

My log4j property file for client log is


[coherence@coherence01 config]$ cat log4j.properties
# Define the root logger with appender file
log4j.rootLogger = DEBUG, FILE

# Define the file appender
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.File=${user.home}/log/cachelog.log

log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d{DATE} [%t] %5p %c{1}:%L - %m%n

Server log is

[coherence@coherence01 addons]$ cat log4j.properties
log4j.logger.Coherence=INFO, file

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%m%n

log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=/home/coherence/log/coherence-${pid}.log
log4j.appender.file.threshold=DEBUG
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=5
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%m%n

How can I separate the logs?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points