sentence
stringlengths
1
1.38k
label
stringclasses
3 values
JavaFX is for web apps is it not?
o
I am looking to make native Desktop apps.
o
JavaFX 2.0 works well for desktop apps as well.
p
concurrent log4j.
o
I have my own logging engine which writes the logs on a separate thread with a blocking queue.
o
For the sake of using "standard software" I am thinking about switching to log4j.
p
I don't want my highly concurrent software to be slowed down by log commands that write everything to disk as some as the command is called.
n
Can log4j be used as a dumpster instead?
o
logj4 might not be your best bet, if you need highly concurrent logging you should go w/ just something like a concurrent linked queue (or blocking) and a dedicated polling thread.
p
Logging by default blocks hard (if you need to log for real).
n
If you need even higher concurrency you can use a queue per thread (and still poll each queue by a separate one).
o
See URL_http://stackoverflow.com/a/13144054/603516 for some links to related log4j locking issues.
o
Log4j is the logging implementation on most JavaEE app-servers out there, so that's a good advert for its concurrency abilities.
p
Having said that, I have seen Log4j 1.2 deadlock under high load conditions.
n
A bit of investigation highlighted some scarily bad synchronization in the source code.
n
Apparently, this was fixed in Log4j 1.3, although development on this has slowed or stopped altogether - I get the feeling much of the source was unsalvageable.
n
However, if you're free to choose, then you should consider URL_http://logback.qos.ch/ [Logback] instead, the spiritual successor to Log4j.
o
It's a ground-up redesign, and is probably a better option for you.
o
Most (all) EE servers are anything but heavily concurrent, simply they are not.
n
Saying that after 2 days+night battles vs tomcat data races.
o
Note.
o
as "heavily concurrent" I assume 32+ cores that don't get starved.
n
Check out log4j's URL_http://logging.apache.org/log4j/1.2/apidocs/org/apache/l og4j/AsyncAppender.html [asynchronous-appender] , it buffers log messages ad passes them on to appenders using a separate thread.
o
It might be that you decide the log4j async appender is not appropriate URL_http://glueclue.blogspot.com/2007/01/log4j-asyncappender-is-not- always_31.html [(here-are-some-complaints-about-it)] , you could always make your own appender.
o
I'd not call the impl.
o
highly concurrent at any rate.
o
It's async but not highly concurrent.
o
Logging using SL4J, Jakarta Commons logging, log4j for third party libraries and my own code.
o
I have some questions about logging, more specifically about setting it up and making sure it works.
p
The project I'm doing will use URL_http://wicket.apache.org/ [Wicket] , URL_http://www.springsource.org/ [Spring] and URL_http://www.hibernate.org/ [Hibernate] .
o
I know that Wicket and Hibernate uses Simple Logging Facade for Java ( URL_http://www.slf4j.org/ [SL4J] ) and that Spring is using the URL_http://commons.apache.org/logging/ [logging-component-from-Apache-Commons] .
p
Will they co-exist happily?I thought I would use URL_http://logging.apache.org/log4j/1.2/index.html [log4j] together with both SL4J and the logging component from Apache commons, do you think that's a good idea?
o
Can I set up them all to output logging data into a common file?Or should I use separate files?Or should I store the logging messages in the database?
o
(I'd rather not, as I find grepping etc on text files quite convenient.
o
) For Spring I guess I need some kind of configuration file for the Apache Commons logging component as well where I direct it to use log4j?
o
When I've set these up I guess to see that everything works I set the logging level to INFO as it's fairly certain that all three of the frameworks output some information in that mode?
o
Or is there an even better way to make sure?
o
And my last question.
o
In the project I'm starting, do you recommend that I use SL4J for my own logging purposes?
o
(I thought I would use log4j directly, but that was before I learned a little bit more about logging and a lot of respectable libraries seem to choose the path of a bridge/facade for their logging needs.
n
And if it gets us flexibility without added cost there's no reason not to do it that way.
o
) I'm looking forward to hearing more from you about how you are doing your logging.
o
It's a new area for me which I'm eager to improve myself in.
o
Well SLF4J is just a facade, like commons logging, which means they still need something else to work.
p
They permit library authors to not force users into having multiple logging library and configuration.
o
Log4j and logback are regular logging libs.
o
See URL_http://stackoverflow.com/questions/354837/whats-up-with-logging-in- java [here] for more info.
o
SLF4J has a URL_http://www.slf4j.org/legacy.html [commons-logging-bridge] that you can use to replace the commons logging library.
o
I think the schema there explain the situation very well.
p
Now, you just need to use slf4j-logj12.jar to have commons logging and slf4j use log4j (or anything else you chose; btw, logback doesn't need an additional library to be used with slf4j) as a backing engine.
o
You application will thus have jcl104-over-slf4j.jar (to bridge jakarta commons logging to slf4j) slf4j.jar (for hibernate and others to use slf4j) slf4j-logj12.jar (for slf4j to use log4j as a backend) log4j.jar (for your application to use.
o
all config will also be done here) .
o
Remember to not confuse slf4j-xxxx.jar with xxxx-over-slf4j.jar.
p
The former is for funneling to your desired logging framework (log4j, logback, etc), the latter is to replace the used logging framework.
o
And using both can create a breach in the space-time fabric!.
o
Stop the madness.
o
Does anybody else think that logging has become far too complex?
o
I thought log4j was a terrific thing, worthy of being made a standard.
p
I didn't follow the JCP history closely enough to know why Sun decided to go their own way.
p
This is ridiculous.
o
I use ACL + log4j.
o
Here is how to redirect everything to SLF4J: remove CODETERM1 from your classpath.
o
If you are using Maven and have trouble getting rid of commons-logging, see URL_http://day-to-day-stuff.blogspot.com/2007/07/no-more-commons-logging.html [this] .
o
put CODETERM2 in your classpath (it comes in the SLF4J distribution).
o
This is a drop-in replacement that mimics JCL's classes, but calls SLF4J internally.
o
This will take care of Spring, and any other framework that uses JCL.
o
Connect SLF4J to your favorite backend (Log4J, Logback...) by putting CODETERM3 in the classpath.
p
Configure the backend to log all categories to one file, and you're done.
o
As for using SLF4J in your application, it is not strictly necessary.
o
Libraries like JCL and SLF4J were originally designed for people who write libraries and do no want to lock their clients into a particular logging framework.
o
PS: by the way, JCL Jakarta Commons Logging .
o
Thanks!
o
I changed to JCL in the OP.
o
What do you mean by "onfigure the backend to log all categories to one file"?
o
Could you provide more details?
o
In order to exclude commons-logging from your final build in maven use scope 'provided' instead of the 99.0-does-not-exist from Eric.
o
Log4j 2.0 and SLF4J and the never ending future of java logging frameworks.
o
So I just found out today that Log4J 2.0 is now actively being developed, there is an alpha version and it is said to replace logback.
o
Right now in my app I have close to 4 maybe more logging frameworks: Java Util Logging log4j slf4j logback (ignored thanks to a maven provided hack) commons logging (ignored thanks to a maven provided hack) And tomcat has its own JULI adapter I have been using log4j (1.2.x) because frankly I just haven't needed the _features_ of the newer guys but I have been tempted lately to switch to SLF4J and mainly I don't want to have rewrite my complicated log4j configurations files to a new format** (logback).
o
Now my question is in terms of what I should code against is SLF4J the right choice for the future given log4j 2.0.
o
_It seems like I should just stick with old log4j ( CODETERM1 ) as it is the lowest common denominator?_ on further examination of log4j 2.0 while very similar it appears the configuration is not backward compatible with log4j 1.2.
n
Looks like logback is the best choice.
p
For some projects we put together, logging framework was more driven by the open source frameworks we were using.
p
But it is a state of preference.
o
Yes I have done similar likewise but good ole log4j is almost in every project except for really really new projects and its the only one I can remember how to configure.
p
The big annoyance in switching is actually the configuration and supported appenders.
o
Code with SLF4J, and choose backend at runtime.
o
Changing logging backend is not a problem if you are using SLF4J Api.
o
I am the founder of log4j, slf4j and logback projects but unaffiliated with log4j 2.0.
o
As I understand it, notwithstanding its name, log4j 2.0 is very different than log4j 1.x.
o
As far as the user API is concerned, log4j 2.0 is largely incompatible with log4j 1.x.
o
Log4j 2.0 provides an adaptation layer for log4j 1.x which at present time (2012-08) is URL_http://logging.apache.org/log4j/2.x/log4j12-api/api.html [CODETERM1] .
o
I guess I was hoping for a grand unification of logging (GUL) but I guess like physics (GUT) that isn't going to happen anytime soon :).
o
BTW thanks for log4j (original).
o
My interest in log4j 2.0 (over logback) is not having to switch configuration to the new logback style (IMHO its easier to refactor to SLF4J) than change the config of 10 or so projects.
p
Are you familiar with the log4j.properties translator?
o
It can greatly help in migrating log4j.properties to logback.xml.
o
Try it out URL_http://logback.qos.ch/translator/ .
o
I think I vaguely remember seeing that in the logback project but I need one for the XML format.
o
I should enhance the translator to deal with log4j.xml as well.
p