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 "Zachary Boe (JIRA)" <ji...@apache.org> on 2015/08/20 23:48:47 UTC

[jira] [Comment Edited] (LOG4J2-752) Log4J2 not finding core Log4J2Plugins.dat when a custom appender is present

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

Zachary Boe edited comment on LOG4J2-752 at 8/20/15 9:48 PM:
-------------------------------------------------------------

Upon further inspection (and a year later), I've boiled this down a little further. If I run my app on the command line with the command "java -cp lib/log4j-api-2.3.jar:lib/log4j-core-2.3.jar:App.jar main.Main" then it works just fine, even with Webstart enabled. The Jar is built with Ant from Netbeans, and has the Class-Path directive set in the manifest to include the two log4j2 libs.

I would really like to able to use "java -jar App.jar" and have this work. It seems like it's picking up the jars for the purpose of running the code, but it just can't find the Log4j2Plugins.dat file inside is what I'm thinking. I'm at a loss here. Any help would be appreciated.

Edit: Also, using the "packages" directive in the log4j2.xml file doesn't not change anything.


was (Author: zsb):
Upon further inspection (and a year later), I've boiled this down a little further. If I run my app on the command line with the command "java -cp lib/log4j-api-2.3.jar:lib/log4j-core-2.3.jar:App.jar main.Main" then it works just fine, even with Webstart enabled. The Jar is built with Ant from Netbeans, and has the Class-Path directive set in the manifest to include the two log4j2 libs.

I would really like to able to use "java -jar App.jar" and have this work. It seems like it's picking up the jars for the purpose of running the code, but it just can't find the Log4j2Plugins.dat file inside is what I'm thinking. I'm at a loss here. Any help would be appreciated.

> Log4J2 not finding core Log4J2Plugins.dat when a custom appender is present
> ---------------------------------------------------------------------------
>
>                 Key: LOG4J2-752
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-752
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0
>         Environment: RHEL 6
> Netbeans 7.4
> Java 1.7.0u45
>            Reporter: Zachary Boe
>
> I'm working on a GUI that needs to be webstart capable.  I have a custom appender that I use to capture logging entries in memory so they can be displayed on a Swing panel for the user.  Everything runs fine when I run it straight from the IDE, but things get wonky when I try to build the jars and run with the "java -jar" incantation.
> In short, with the webstart option *on* and when the custom appender is present (in a package in the src/ folder, not even referenced anywhere else in code or in log4j2.xml), Log4J2 will fail to find the Log4J2Plugins.dat file in the log4j2-core jar, and will subsequently fail to find any other appenders/loggers besides my custom one. Upon removing the package with the custom appender, Log4J2 will find it's own .dat file and everything is fine.
> With the webstart option *off* in the netbeans menu (which all it seems to do, by looking a diff, is remove the "Codebase: *" line from META-INF/MANIFEST.MF), the custom appender and log4j2 work in harmony.
> I have the log4j2-core and log4j2-api jars added as compile-time libraries. I can unzip the log4j2-core jar and my application jar after everything is built and find the respective Log4J2Plugins.dat files in each jar.
> I have example netbeans projects which I can hopefully attach at request to demonstrate this problem. I feel I've done a great bit of troubleshooting to narrow down this problem. Hopefully this can be resolved, or I may have to downgrade to log4j, since it's known working on other projects in house.
> Thanks for your help!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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