[ 
https://issues.apache.org/jira/browse/CASSANDRA-625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844400#action_12844400
 ] 

gabriele renzi commented on CASSANDRA-625:
------------------------------------------

yes, it's possible, re-attaching patch in a moment, see example:

normal run:
$ ./bin/cassandra -f
 INFO 08:39:45,390 Auto DiskAccessMode determined to be standard
 INFO 08:39:45,692 Sampling index for 
/var/lib/cassandra/data/system/LocationInfo-b-1-<>
 INFO 08:39:45,707 Sampling index for 
/var/lib/cassandra/data/system/LocationInfo-b-2-<>
 INFO 08:39:45,724 Replaying 
/var/lib/cassandra/commitlog/CommitLog-1268379533004.log



move logback jars to build/lib/jars, output is obviously different
$ ./bin/cassandra -f
08:38:52.463 [main] DEBUG o.a.c.config.DatabaseDescriptor - Loading settings 
from ./bin/../conf/storage-conf.xml
08:38:52.602 [main] DEBUG o.a.c.config.DatabaseDescriptor - Syncing log with a 
period of 10000
08:38:52.606 [main] INFO  o.a.c.config.DatabaseDescriptor - Auto DiskAccessMode 
determined to be standard
08:38:52.686 [main] DEBUG o.a.c.config.DatabaseDescriptor - setting 
autoBootstrap to false
08:38:52.744 [main] DEBUG o.a.cassandra.thrift.CassandraDaemon - opening 
keyspace Keyspace1
08:38:52.868 [main] DEBUG o.a.cassandra.db.ColumnFamilyStore - Starting CFS 
Super1
....

now creating a logback configuration equals to log4j's 
$ cat >> logback.xml
<?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>%5p %d{HH:mm:ss,SSS} %m%n</Pattern>
    </layout>
  </appender>
  <appender name="R" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <!--See also 
http://logback.qos.ch/manual/appenders.html#RollingFileAppender-->
    <File>/var/log/cassandra/system.log</File>
    <layout class="ch.qos.logback.classic.PatternLayout">
      <Pattern>%5p [%t] %d{ISO8601} %F (line %L) %m%n</Pattern>
    </layout>
    <rollingPolicy 
class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"/>
    <triggeringPolicy 
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"/>
  </appender>
  <root level="INFO">
    <appender-ref ref="stdout"/>
    <appender-ref ref="R"/>
  </root>
</configuration>

$ ./bin/cassandra -f
 INFO 08:40:59,737 Auto DiskAccessMode determined to be standard
 INFO 08:40:59,979 Sampling index for 
/var/lib/cassandra/data/system/LocationInfo-b-1-<>
 INFO 08:40:59,993 Sampling index for 
/var/lib/cassandra/data/system/LocationInfo-b-2-<>
 INFO 08:40:59,995 Sampling index for 
/var/lib/cassandra/data/system/LocationInfo-b-3-<>
 INFO 08:41:00,012 Replaying 
/var/lib/cassandra/commitlog/CommitLog-1268379585778.log

it works :)


> Migrate to slf4j from log4j in cassandra code
> ---------------------------------------------
>
>                 Key: CASSANDRA-625
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-625
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>         Environment: all
>            Reporter: gabriele renzi
>            Priority: Minor
>             Fix For: 0.7
>
>         Attachments: CASSANDRA-625-3.patch
>
>
> currently code generated from thrift uses slf4j while cassandra uses raw 
> log4j. 
> There are various level in which this can be changed: 
> * simply switch log4j loggers with slf4j logger (done in patch)
> * replacing log4j-isms (e.g. string concatenation+isFooEnabled in all code 
> paths) with slf4j-isms (marker string + additional arguments)
> * remove code that is already available for lsf4j (LogUtils.java, I believe 
> is unnecessary)
> I am posting this as a reminder, I have a half baked patch locally but it 
> needs more work 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to