<div dir="ltr"><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;color:rgb(0,0,0);font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:18px">
I my project .log4j.properties in classpath but when i use mvn assembly:assembly a *.tar.gz and then tar xvf x.tar.gz</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;color:rgb(0,0,0);font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:18px">
java -cp lib/*:. Test.main</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;color:rgb(0,0,0);font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;line-height:18px">
the log output to console ,not output to logj.properites assignation log file .</p><pre class="" style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:14px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;overflow:auto;width:auto;max-height:600px;word-wrap:normal;color:rgb(0,0,0);line-height:18px">
<code style="margin:0px;padding:0px;border:0px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif"><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">➜</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> git</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">:(</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">master</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">)</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">✗</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent"> ls </span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">-</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">al lib</span><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:gray">/*log*
-rw-r--r-- 1 fuyou staff 60686 8 12 16:47 lib/commons-logging-1.1.1.jar
-rw-r--r-- 1 fuyou staff 367444 8 1 08:47 lib/log4j-1.2.14.jar
-rw-r--r-- 1 fuyou staff 20573 12 5 10:10 lib/logging-1.0.jar
-rw-r--r-- 1 fuyou staff 10792 8 1 08:47 lib/logstat-client-1.0.2.jar
-rw-r--r-- 1 fuyou staff 23786 8 1 08:47 lib/logstat-common-1.0.1.jar
-rw-r--r-- 1 fuyou staff 8869 9 4 15:28 lib/slf4j-log4j12-1.7.5.jar
➜ git:(master) ✗ ls -al lib/*slf*
-rw-r--r-- 1 fuyou staff 26084 8 12 08:40 lib/slf4j-api-1.7.5.jar
-rw-r--r-- 1 fuyou staff 8869 9 4 15:28 lib/slf4j-log4j12-1.7.5.jar
➜ git:(master) ✗ ls -al lib/*jcl-over-slf4j*
zsh: no matches found: lib/*jcl-over-slf4j*
➜ git:(master) ✗ ls -al lib
log4j.properties content</span></code></pre><pre class="" style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:14px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;overflow:auto;width:auto;max-height:600px;word-wrap:normal;color:rgb(0,0,0);line-height:18px">
<code style="margin:0px;padding:0px;border:0px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif"><span class="" style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent;color:gray">
log4j.rootLogger=info, root
log4j.appender.root=org.apache.log4j.DailyRollingFileAppender
log4j.appender.root.DatePattern='.'yyyy-MM-dd
log4j.appender.root.File=logs/test.log
log4j.appender.root.layout=org.apache.log4j.PatternLayout
log4j.appender.root.layout.ConversionPattern=%d %-5p %c{2} %m%n
log4j.appender.root.Append=true</span></code></pre><div> I also ask the question in <a href="http://stackoverflow.com/questions/20579123/log-cant-write-to-logfile-but-write-to-console">stackoverlow</a></div>-- <br> =============================================<div>
fuyou001</div><div>Best Regards<br><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"> </span></div>
</div>
</div>