So you are saying that you would simply add a log4j1 to log4j2 bridge right. And those libraries that use the old version then automatically use the bridge. And everything runs agains the new version then regardless.

I believe slf4j is also meant for that right? I don't like its deployment but it's super easy of course. So you would bridge log4j1 to log4j2 for example (for older libraries/systems) and meanwhile you write your own code against slf4j so that it is portable to another framework if required.

I would personally still be tempted to move to log4j2 if it's a better product. But mostly I believe the Java progression version requirement is what would hold me back. Java 1.6 is probably not so bad. Knowing that if I jumped to log4j2 I would need to be very conservative and not jump on the 1.7 and 1.8 bandwagon, would ... reduce the attractiveness of the upgrade. From my perception (and I must say I am *very* perceptive, people regularly tell me if I get the chance, how right on the mark I am) the biggest benefit of log4j2 from an upgrade perspective is to be right where the money is. The biggest downside is higher java version requirements. I don't think (If I am allowed to voice a sentiment that may not be warranted here) the new API thing is absolute perfection but that would not hold me back, because progress is possible and progress is what happens in the future, not the past.

I think that holds true for many people. "Don't fix it if it ain't broke" has not ever really been a thing that people agree with in their actual choices ;-). Haha.


Op 14-8-2015 om 18:43 schreef Douglas Wegscheid:
which is the reason that projects aren't 'complying'?

    - v2 is not better than v1
    - the upgrade path and bridge jars mean the upgrading is really not
    necessary.

I suspect it's the 2nd: why put a bunch of work into reworking all the
logging in my library (and forcing my users to change their logging
framework, which may not support other dependencies my project has) when I
can spend that effort into making my library do what it does better?

with the way things are, I can use old libraries that use j.u.l, log4j1,
slf4j, or jcl with log4j2 (or slf4j), just need to use the bridge
utilities. I'm to the point when I start a new project that I always start
with a slf4j or log4j2 configuration (and I still write my stuff against
the slf4j APIs), write a method to set up any bridging, and call that
method first thing....


*■ DOUGLAS E. WEGSCHEID* // Lead Analyst, Directories
(269) 923-5278 // [email protected]

"A wrong note played hesitatingly is a wrong note. A wrong note played with
conviction is interpretation."

On Fri, Aug 14, 2015 at 12:15 PM, Xen <[email protected]> wrote:

Then why do you need to persuade people? Why are they unwilling? Obviously
they stand to lose something or they would 'comply' of their own.

;-). Seriously, that's just the case. Your personal opinion doesn't matter
much it is about what it does to people.

Op 14-8-2015 om 16:19 schreef Mikael Ståldal:

I don't agree with you that Log4j 2 is worse than Log4j 1. Log4j 2 is a
huge improvement.

On Fri, Aug 14, 2015 at 4:05 PM, Xen <[email protected]> wrote:

That is precisely the sort of stuff you get when your application or newer
version is actually worse than your older version, and now you need to do
effort to "persuade" others in joining you when you have not really
improved things ;-).

I was writing some longer email I guess, I will send it later, I guess.

Bye.

Op 14-8-2015 om 10:27 schreef Mikael Ståldal:

Perhaps the Log4j developers should spend some time to persuade other

Apache projects to start using Log4j 2.

On Fri, Aug 14, 2015 at 8:05 AM, Jinhong Lu <[email protected]>
wrote:

you mean upgrade to log4j2?

but all my projects, including spark, hadoop, kafka, they all use
log4j1.x

2015-08-14 13:25 GMT+08:00 Ralph Goers <[email protected]>:

Please see -


https://blogs.apache.org/foundation/entry/apache_logging_services_project_announces

<


https://blogs.apache.org/foundation/entry/apache_logging_services_project_announces

.
Ralph

On Aug 13, 2015, at 10:08 PM, Jinhong Lu <[email protected]>
wrote:

I met this exception when using syslogappender.

my log4j version is 1.2.16.

Any idea?  thanks.




java.lang.NoSuchFieldError: errorHandler
         at

org.apache.log4j.net
.SyslogAppender.setSyslogHost(SyslogAppender.java:391)

~[log4j-1.2.16.jar:na]
         at

com.netease.sytopology.util.MySysLogger.<init>(MySysLogger.java:39)
~[stormjar.jar:na]
         at


com.netease.sytopology.util.MySysLogger.getInstance(MySysLogger.java:28)

~[stormjar.jar:na]
         at


com.netease.sytopology.bolt.FilterFunction.prepare(FilterFunction.java:65)

~[stormjar.jar:na]
         at


storm.trident.planner.processor.EachProcessor.prepare(EachProcessor.java:54)

~[storm-core-0.9.4.jar:0.9.4]
         at


storm.trident.planner.SubtopologyBolt.prepare(SubtopologyBolt.java:121)

~[storm-core-0.9.4.jar:0.9.4]
         at


storm.trident.topology.TridentBoltExecutor.prepare(TridentBoltExecutor.java:231)

~[storm-core-0.9.4.jar:0.9.4]
         at


backtype.storm.daemon.executor$fn__4722$fn__4734.invoke(executor.clj:692)

~[storm-core-0.9.4.jar:0.9.4]
         at
backtype.storm.util$async_loop$fn__458.invoke(util.clj:461)
~[storm-core-0.9.4.jar:0.9.4]
         at clojure.lang.AFn.run(AFn.java:24) [clojure-1.5.1.jar:na]
         at java.lang.Thread.run(Thread.java:745) [na:1.7.0_67]


And here is my code:


import org.apache.log4j.Level;

import org.apache.log4j.Logger;

import org.apache.log4j.PatternLayout;

import org.apache.log4j.helpers.OnlyOnceErrorHandler;

import org.apache.log4j.net.SyslogAppender;

import org.apache.log4j.varia.FallbackErrorHandler;


public class MySysLogger {

//以下参数均可根据需要放到配置文件中。

//默认日志级别

private static Level level = Level.INFO;

//日志接收服务器

private static String syslogHost = "172.16.1.18";

//设置facility

private static String facility = "local7";

private static String  loggerName = "";


public static void setLoggerName(String loggerName2) {

MySysLogger.loggerName = loggerName2;

}


private static Logger LOG = null;


public static synchronized Logger getInstance() {

if (LOG == null) {

new MySysLogger(loggerName);

}

return LOG;

}


private  MySysLogger(String loggerName) {


LOG = Logger.getRootLogger();

LOG.setLevel(level);

SyslogAppender appender = new SyslogAppender();

appender.setErrorHandler(new FallbackErrorHandler());


appender.setSyslogHost(syslogHost);

appender.setLayout(new PatternLayout(

"%r " + loggerName +" [%t] %-5p %C%x - %m"));

appender.setHeader(true);

appender.setFacility(facility);

LOG.addAppender(appender);

}


}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to