slf4j - Custom Storm logback appender for Topology -



slf4j - Custom Storm logback appender for Topology -

i have storm topology , log events occur within topology separate log file. trying create custom appender in storm/logback/cluster.xml used log these events. here cluster.xml snippet setting up:

<appender name="a2" class="ch.qos.logback.core.rolling.rollingfileappender"> <file>${storm.home}/logs/custom-logger/cl-log.log</file> <rollingpolicy class="ch.qos.logback.core.rolling.fixedwindowrollingpolicy"> <filenamepattern>${storm.home}/logs/${logfile.name}.%i</filenamepattern> <minindex>1</minindex> <maxindex>9</maxindex> </rollingpolicy> <triggeringpolicy class="ch.qos.logback.core.rolling.sizebasedtriggeringpolicy"> <maxfilesize>100mb</maxfilesize> </triggeringpolicy> <encoder> <pattern>%d{yyyy-mm-dd_hh:mm:ss} %c{1} [%p] %m$n</pattern> </encoder> </appender> <logger name="custom-logger" additivity="false"> <level value="info" /> <appender-ref ref="a2"/> </logger>

i using basic wordcounttopology test example. here snippet of code trying write log file

public static class wordcount extends basebasicbolt { private static final org.slf4j.logger custom_logger = loggerfactory.getlogger("custom-logger"); map<string, integer> counts = new hashmap<string, integer>(); public void execute(tuple tuple, basicoutputcollector collector) { string word = tuple.getstring(0); integer count = counts.get(word); if (count == null) count = 0; count++; counts.put(word, count); custom_logger.info("emitting word[" + word + "] count["+ count + "]"); collector.emit(new values(word, count)); } public void declareoutputfields(outputfieldsdeclarer declarer) { declarer.declare(new fields("word", "count")); } }

no matter do, can't seem these logs show in custom-logger cl-log.log file. possible within storm log specific events specific file using logback? help appreciated.

just completeness, did work. deploying topologies locally , hence logging not occurring. 1 time deployed topologies cluster logging functionality above started working.

slf4j logback apache-storm

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -