Probably easiest would be to pass the params in on the command line, something like:
ZOO_LOG4J_PROP="TRACE,CONSOLE" CLIENT_JVMFLAGS="-Dzookeeper.console.threshold=TRACE" bin/zkCli.sh Patrick On Mon, Oct 28, 2013 at 3:52 PM, Techy Teck <[email protected]> wrote: > I found log4j.properties file which is something like below - What changes > I should make in this file to enable TRACE level logging? Thanks for the > help.. > > # Define some default values that can be overridden by system properties > zookeeper.root.logger=INFO, CONSOLE > zookeeper.console.threshold=INFO > zookeeper.log.dir=. > zookeeper.log.file=zookeeper.log > zookeeper.log.threshold=DEBUG > zookeeper.tracelog.dir=. > zookeeper.tracelog.file=zookeeper_trace.log > > # > # ZooKeeper Logging Configuration > # > > # Format is "<default threshold> (, <appender>)+ > > # DEFAULT: console appender only > log4j.rootLogger=${zookeeper.root.logger} > > # Example with rolling log file > #log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE > > # Example with rolling log file and tracing > #log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE > > # > # Log INFO level and above messages to the console > # > log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender > log4j.appender.CONSOLE.Threshold=${zookeeper.console.threshold} > log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout > log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] > - %-5p [%t:%C{1}@%L] - %m%n > > # > # Add ROLLINGFILE to rootLogger to get log file output > # Log DEBUG level and above messages to a log file > log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender > log4j.appender.ROLLINGFILE.Threshold=${zookeeper.log.threshold} > log4j.appender.ROLLINGFILE.File=${zookeeper.log.dir}/${zookeeper.log.file} > > # Max log file size of 10MB > log4j.appender.ROLLINGFILE.MaxFileSize=10MB > # uncomment the next line to limit number of backup files > #log4j.appender.ROLLINGFILE.MaxBackupIndex=10 > > log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout > log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} > [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n > > > # > # Add TRACEFILE to rootLogger to get log file output > # Log DEBUG level and above messages to a log file > log4j.appender.TRACEFILE=org.apache.log4j.FileAppender > log4j.appender.TRACEFILE.Threshold=TRACE > log4j.appender.TRACEFILE.File=${zookeeper.tracelog.dir}/${zookeeper.tracelog.file} > > log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout > ### Notice we are including log4j's NDC here (%x) > log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} > [myid:%X{myid}] - %-5p [%t:%C{1}@%L][%x] - %m%n > > > > > > On Mon, Oct 28, 2013 at 3:44 PM, Patrick Hunt <[email protected]> wrote: > >> edit your log4j.properties file, should be in conf directory >> (depending how you're running) >> >> Patrick >> >> On Mon, Oct 28, 2013 at 3:30 PM, Techy Teck <[email protected]> >> wrote: >> > @Patrick: How do I enable TRACE level logging as it is working fine in >> > windows command prompt but not in cygwin somehow...? >> > >> > >> > >> > On Mon, Oct 28, 2013 at 3:29 PM, Techy Teck <[email protected]> >> wrote: >> > >> >> Yeah.. It works fine in windows command prompt.. But not in cygwin? Any >> >> thoughts? >> >> >> >> >> >> On Mon, Oct 28, 2013 at 2:36 PM, Camille Fournier <[email protected] >> >wrote: >> >> >> >>> Not obviously... I can do this just fine, although I'm not using cygwin >> >>> but >> >>> instead using zkCli.cmd and zkServer.cmd (which are the windows command >> >>> lines). If you use windows command lines vs cygwin, does it work? >> >>> >> >>> >> >>> >> >>> On Mon, Oct 28, 2013 at 4:13 PM, Techy Teck <[email protected]> >> >>> wrote: >> >>> >> >>> > I started my Zookeeper on my cygwin console like this and it got >> >>> started >> >>> > successfully - >> >>> > >> >>> > username@00542612 ~ >> >>> > $ zkServer.sh start >> >>> > JMX enabled by default >> >>> > Using config: C:\ApacheZookeeper\zookeeper-3.4.5\conf\zoo.cfg >> >>> > Starting zookeeper ... STARTED >> >>> > >> >>> > Now, after connecting to ZooKeeper. I opened a new Cygwin window, and >> >>> issue >> >>> > the following command >> >>> > >> >>> > $ zkCli.sh >> >>> > >> >>> > which will connect to ZooKeeper server running at localhost:2181 by >> >>> > default, and will open zk console. And this is what I got on the >> >>> console. >> >>> > And I believe till now everything is fine - >> >>> > >> >>> > >> >>> > username@00542612 ~ >> >>> > $ zkCli.sh >> >>> > Connecting to localhost:2181 >> >>> > 2013-10-28 12:56:34,958 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > environment:zookeeper.version=3.4.5-1392090, built on 09/30/2012 >> 17:52 >> >>> GMT >> >>> > 2013-10-28 12:56:34,961 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > environment:host.name=00542612.corp.host.com >> >>> > 2013-10-28 12:56:34,961 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > environment:java.version=1.6.0_26 >> >>> > 2013-10-28 12:56:34,962 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > environment:java.vendor=Sun Microsystems Inc. >> >>> > 2013-10-28 12:56:34,962 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > environment:java.home=C:\Java\jdk1.6.0_26\jre >> >>> > 2013-10-28 12:56:34,963 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > >> >>> > >> >>> >> environment:java.class.path=C:\ApacheZookeeper\zookeeper-3.4.5\build\classes;C:\ApacheZookeeper\zookeeper-3.4.5\build\lib\*.jar;C:\ApacheZookeeper\zookeeper-3.4.5\lib\slf4j-log4j12-1.6.1.jar;C:\ApacheZookeeper\zookeeper-3.4.5\lib\slf4j-api-1.6.1.jar;C:\ApacheZookeeper\zookeeper-3.4.5\lib\netty-3.2.2.Final.jar;C:\ApacheZookeeper\zookeeper-3.4.5\lib\log4j-1.2.15.jar;C:\ApacheZookeeper\zookeeper-3.4.5\lib\jline-0.9.94.jar;C:\ApacheZookeeper\zookeeper-3.4.5\zookeeper-3.4.5.jar;C:\ApacheZookeeper\zookeeper-3.4.5\src\java\lib\*.jar;C:\ApacheZookeeper\zookeeper-3.4.5\conf;C;C:\Program >> >>> > Files (x86)\IBM\RationalSDLC\ClearQuest\cqjni.jar >> >>> > 2013-10-28 12:56:34,963 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > >> >>> > >> >>> >> environment:java.library.path=C:\Java\jdk1.6.0_26\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\cygwin\usr\local\bin;C:\cygwin\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\bin;C:\Java\jdk1.6.0_26\bin;C:\cygwin\bin;C:\cygwin\etc\alternatives;C:\Program >> >>> > Files (x86)\DataStax >> >>> > >> >>> > >> >>> >> Community\python;C:\Users\username\openssl\bin;C:\Python27;C:\Python27\Scripts;D:\app\username\product\11.1.0\db_1\bin;C:\apache-maven-3.0.4-bin\apache-maven-3.0.4\bin;C:\Program >> >>> > Files >> >>> > >> >>> > >> >>> >> (x86)\IBM\RationalSDLC\Clearquest\cqcli\bin;C:\Perl64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Perl64\bin;C:\Program >> >>> > Files (x86)\Perforce;C:\Program Files >> >>> > (x86)\IBM\RationalSDLC\ClearCase\bin;C:\Program Files >> >>> > >> >>> > >> >>> >> (x86)\IBM\RationalSDLC\common;D:\ede-5.1.1\apache-ant-1.7.1.2008.06.27\bin;C:\Program >> >>> > Files (x86)\Git\cmd;C:\Program Files\Common Files\Hitachi >> >>> > ID;C:\ApacheZookeeper\zookeeper-3.4.5\bin;%APPDATA%\Python\Scripts;. >> >>> > 2013-10-28 12:56:34,963 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > environment:java.io.tmpdir=C:\cygwin\tmp\ >> >>> > 2013-10-28 12:56:34,964 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > environment:java.compiler=<NA> >> >>> > 2013-10-28 12:56:34,964 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > environment:os.name=Windows 7 >> >>> > 2013-10-28 12:56:34,965 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > environment:os.arch=amd64 >> >>> > 2013-10-28 12:56:34,965 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > environment:os.version=6.1 >> >>> > 2013-10-28 12:56:34,965 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > environment:user.name=username >> >>> > 2013-10-28 12:56:34,966 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > environment:user.home=C:\Users\username >> >>> > 2013-10-28 12:56:34,966 [myid:] - INFO [main:Environment@100] - >> >>> > Client >> >>> > environment:user.dir=C:\cygwin\home\username >> >>> > 2013-10-28 12:56:34,968 [myid:] - INFO [main:ZooKeeper@438] - >> >>> > Initiating client connection, connectString=localhost:2181 >> >>> > sessionTimeout=30000 >> >>> > watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@48b8f82d >> >>> > Welcome to ZooKeeper! >> >>> > 2013-10-28 12:56:35,019 [myid:] - INFO [main-SendThread( >> >>> > 127.0.0.1:2181 >> >>> > ):ClientCnxn$SendThread@966] - Opening socket connection to server >> >>> > 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using >> SASL >> >>> > (Unable to locate a login configuration) >> >>> > JLine support is enabled >> >>> > 2013-10-28 12:56:35,021 [myid:] - INFO [main-SendThread( >> >>> > 127.0.0.1:2181 >> >>> > ):ClientCnxn$SendThread@849] - Socket connection established to >> >>> > 127.0.0.1/127.0.0.1:2181, initiating session >> >>> > 2013-10-28 12:56:35,047 [myid:] - INFO [main-SendThread( >> >>> > 127.0.0.1:2181 >> >>> > ):ClientCnxn$SendThread@1207] - Session establishment complete on >> >>> server >> >>> > 127.0.0.1/127.0.0.1:2181, sessionid = 0x14200a378c30000, negotiated >> >>> > timeout >> >>> > = 30000 >> >>> > >> >>> > WATCHER:: >> >>> > >> >>> > WatchedEvent state:SyncConnected type:None path:null >> >>> > [zk: localhost:2181(CONNECTED) 0] >> >>> > >> >>> > >> >>> > Now I was trying to do `ls /` to see how many nodes I have in general >> >>> or I >> >>> > also trying using help command and then press enter key but nothing >> is >> >>> > happening on my console - >> >>> > >> >>> > See below - >> >>> > >> >>> > WatchedEvent state:SyncConnected type:None path:null >> >>> > [zk: localhost:2181(CONNECTED) 0] ls / >> >>> > >> >>> > >> >>> > After writing `ls /` and I pressed enter, nothing showed up in my >> >>> console >> >>> > and same with `help` as well... This is my first time working with >> >>> > Zookeeper.. Does anyone know what wrong I am doing here? >> >>> > >> >>> >> >> >> >> >>
