You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Ralph Goers (JIRA)" <ji...@apache.org> on 2014/01/02 06:41:50 UTC

[jira] [Commented] (LOG4J2-369) How to include the log4j2 lib jar into a jar with my application class and run it ?

    [ https://issues.apache.org/jira/browse/LOG4J2-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13860023#comment-13860023 ] 

Ralph Goers commented on LOG4J2-369:
------------------------------------

It is not recommended that you unjar third party jars and then repackage them in your own jar.  Why is it not possible to specify your jars in the classpath?

However, if you really need to package everything together for some reason then you will need to make sure that the resulting jar includes all the class files as well as org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat. However, if you try to include multiple log4j2 implementation jars, such as core and flume, and/or you have your own Log4j plugins, then you will have to run the PluginManager against all the classes going into the jar as described at http://logging.apache.org/log4j/2.x/manual/plugins.html#Plugin_Preloading.



> How to include the log4j2 lib jar into a jar with my application class and run it ?
> -----------------------------------------------------------------------------------
>
>                 Key: LOG4J2-369
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-369
>             Project: Log4j 2
>          Issue Type: Bug
>            Reporter: wei wang
>              Labels: mentor
>   Original Estimate: 0.2h
>  Remaining Estimate: 0.2h
>
> I used ant to build a app.jar which has log4j2.xml in the jar, however when I run the jar, it will miss the log4j2-core***.jar and log4j2-api***.jar as the lib. But I need to distribute the lib together with my app.jar as one jar file and run the app.jar(with the exlib in the jar), please tell me how to do that?
> I have tried simply pack the log4j2***.jar into the app.jar, but never print out any log, I think somehow must set the path inside jar to point the log4j2.properties in the log4j-***.jar file.
> Thanks!



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org