Hello Team,

I am trying to externalize log4j from my task.

So at present I run all the task from one tar.gz. And inside that I have 
log4j.xml.

But now I want to externalize the log4j.xml so that I can have more control 
over logs. So before running my task I tried to set the JAVA_OPTS:


export 
JAVA_OPTS="-Dlog4j.configuration=file://$PWD/deploy/alice/config/log4j.xml "



And I get the following error when I run my task :



Like : deploy/alice/bin/run-job.sh 
--config-factory=org.apache.samza.config.factories.PropertiesConfigFactory 
--config-path=file://$PWD/deploy/alice/config/EntryTask.properties



log4j:ERROR Could not create an Appender. Reported error follows.

org.apache.samza.SamzaException: Got null container name from system property: 
samza.container.name. This is used as the key for the log appender, so can't 
proceed.

        at 
org.apache.samza.logging.log4j.StreamAppender.activateOptions(StreamAppender.java:89)

        at 
org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)

        at 
org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:295)

        at 
org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)



Then I tried with following command :


export 
JAVA_OPTS="-Dlog4j.configuration=file://$PWD/deploy/alice/config/log4j.xml 
-Dsamza.container.name=samza-application-master"


log4j:ERROR Could not create an Appender. Reported error follows.
java.lang.NullPointerException
        at java.io.StringReader.<init>(StringReader.java:50)
        at 
org.codehaus.jackson.JsonFactory.createJsonParser(JsonFactory.java:636)
        at 
org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1863)
        at 
org.apache.samza.logging.log4j.StreamAppender.getConfig(StreamAppender.java:180)
        at 
org.apache.samza.logging.log4j.StreamAppender.activateOptions(StreamAppender.java:92)
        at 
org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
        at 
org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:295)



So my doubt is : why we need to give first of all 
-Dsamza.container.name=samza-application-master as it is already present in 
run-am.sh

Second thing could anyone please help me in externilaztion of log4j.xml.

  Regards,
Ankush
***********************************************************************************************************************

This email message and any attachments are intended solely for the use of the 
addressee. If you are not the intended recipient, you are prohibited from 
reading, disclosing, reproducing, distributing, disseminating or otherwise 
using this transmission. If you have received this message in error, please 
promptly notify the sender by reply email and immediately delete this message 
from your system. This message and any attachments may contain information that 
is confidential, privileged or exempt from disclosure. Delivery of this message 
to any person other than the intended recipient is not intended to waive any 
right or privilege. Message transmission is not guaranteed to be secure or free 
of software viruses.
***********************************************************************************************************************

Reply via email to