I'm looking for a way to make log4net support zeroconf to publish logs to Apache Chainsaw (see here: Does log4net support zeroconf?). Apparently log4j can already do this using a ZeroConfSocketHubAppender.
Where might I be able to view the source for the java ZeroConfSocketHubAppender? I've looked both in the Apache Chainsaw and in the Log4j repositories but was unsuccessful.
ZeroConf is a log4j 'companion', but ZeroConfSocketHubAppender (and this companion) is no longer necessary due to the fact that most network-based appenders in log4j have ZeroConf support built-in as of log4j 1.2.16.
All you need to do to enable ZeroConf is add jmdns.jar to your classpath and set the 'advertiseViaMulticastDNS' param to 'true' in the appender configuration.
Here's the commit & log info describing the changes which improved ZeroConf support in the appenders (and receivers):
http://svn.apache.org/viewvc?view=revision&revision=924176
Here is a link to the ZeroConf page if you still want to use that
http://logging.apache.org/log4j/companions/zeroconf/source-repository.html
By the way, the svn HEAD revision of Chainsaw (which should be released soon) includes support for using the advertised ZeroConf appender information to automatically create receivers.
Related
If log4j doesn't support this then is there some drop-in replacement for log4j that does? I've gone through the docs and lots of google searches, unfortunately all search results come up with "exploit" or "vulnerability" articles.
Splunk provides a splunk-library-javalogging that has appenders for both Log4j2 Core (the reference Log4j2 API implementation) and Logback (the reference SLF4J API implementation).
The appenders use OkHttp 3.x under the hood, so they will behave as all OkHttp-based components. Since splunk-library-javalogging does not set either a proxy nor a proxySelector explicitly (cf. source code), OkHttp falls back to the system wide ProxySelector.
Without any code modification on your part you can use the JVM-wide proxy settings as in this question.
Remark: if by log4j you are referring to Log4j 1.x, you need to replace the log4j:log4j artifact with either log4j-over-slf4j (which forwards to the SLF4J API) or log4j-1.2-api (which forwards to the Log4j2 API).
I've followed the doc here : https://logging.apache.org/log4j/2.x/manual/migration.html
Also looked at https://logging.apache.org/log4j/2.x/manual/configuration.html#Properties
My existing log4j.properties only uses DailyRollingFileAppender, ConsoleAppender, both of which are under the 'Supported Components', so I shouldn't be forced to convert my log4j.properties file into log4j2.properties format. I'm not accessing methods and classes internal to the Log4j 1.x implementation, as suggested by the document.
For using the bridge, I previously was using both log4j1.compatibility and log4j.configuration, but the document suggests using 'any one' (tried using just one, doesn't work)
I can build my application successfully, however, my application no longer logs anything. What am I missing?
You may want to consider reload4j as a drop-in replacement for log4j 1.x. Initiated by Ceki Gülcü, the original author of Apache log4j 1.x, the reload4j project is a fork of Apache log4j version 1.2.17 with the goal of fixing pressing security issues.
The reload4j project offers a clear and easy migration path for the users who have an urgent need to fix vulnerabilities in log4j 1.2.17.
You don't need to update your properties file.
You can add a log4j2.component.properties file on the class path (in my case, in the same directory as my log4j.properties file) to set the log4j1.compatibility property, like this:
log4j1.compatibility=true
In our case, it only required setting the compatibility property and then it automatically picked up the log4j.properties file that was available on the class path.
Figured it out.
The answer lied in the Automatic Configuration section
I'm upgrading Log4j-1.2.17 to Log4j2-2.12.2 in my project.
To do that I'm using the log4j-1.2 bridge.
In old version I use property file to configure log4j.
After upgrade everything looks ok, no errors, no warnings. But logs don't appear in file pointed in properties file.
I realized that PropertyConfigurator.class exists in log4j-1.2-api.jar, but methods don't have implementation.
empty PropertyConfigurator.configure(Properties properties)
Can you explain me that?
Which configuration syntax is correct when I use log4j-1.2-api.jar? log4j or log4j2?
Prior to Log4j 2.13.0 log4j-1.2-api only provides compatibility for applications that used the log4j 1.x API for logging. The Log4j 2 configuration is still used as all logging calls are redirected to Log4j 2. So only the Log4j 2 configuration syntax would be valid.
Many of the old log4j 1.x internal classes are also present because many applications were using them in an attempt manually manipulate logging, much of which probably isn't necessary with Log4j 2.
In Log4j 2.13.0 the log4j-1.2-api was extended to provide experimental support for Log4j 1.x configuration files. You would have to compare your log4j 1 configurations with the documentation to determine if that support will work for you. However, the Log4j 1.x PropertyConfigurator still will be a no-op even with the compatibility support.
What Log4J version is Tibco BusinessWorks 5 using?
And can I use the NoSQL appenders in that version? Can it be done without installing the Log4J 1-2 bridge?
Later update: It seems that so far changing the Log4J configuration file does not have too much effect. See Changing Log4J configuration in Tibco BW/Designer does not have the desired effect.
You should be able to find it from below location of your TIBCO products installation.
Go to ../tibco/tpcl/<version>/lib and look for `log4j.jar
And you do not have to install log4j explicitly.
I believe, you should be able to add your required appender in the file ../tibco/bw/<version>/lib/log4j.properties. Also there is `lo4j.xml in case properties file does have worked. Try it out.
Just to complement Rao's response, you also need to add to restart your engines and make sure you added an appender to the right logger, namely bw.logger from either the log4j.properties or log4j.xmlfile.
This is not possible with internal Tibco logging. Only Java activities can use custom loggers.
When I add org.jxls dependency to pom,it seems to affect log4j outputs.I set log4j log level "ERROR",but it outputs DEBUG infomation to console.But when I remove org.jxls,log4j works right.
Although Jxls-2 uses SLF4J as a logging facade it has a dependency to Logback because it uses some if its XML processing utilities.
If you do not use Logback but another logging framework (e.g. log4j) and configured SLF4J binding you can still end up with "Class path contains multiple SLF4J bindings" warning.
Currently there is a bug in Jxls-2 to remove the Logback dependency.
Until it is fixed you may need to have a logback.xml in your classpath.
Update
The issue is now resolved in JXLS v2.2.9 .
So now it should be possible to plugin any logging framework following the instructions in SLF4J manual