Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (482)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (550)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [odejava] why log4j?  (Read 1883 times)
0 Members and 1 Guest are viewing this topic.
Offline frdfsnlght

Senior Newbie




Trying to understand


« Posted 2004-05-25 01:33:54 »

Will, I assume you'll be reading this.

I seem to recall a post (but can't locate it now) about odejava using log4j. I never said anything then, but I am now. Why not just use the built in logging? It's yet another library I need to download and install now.

-Tab
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #1 - Posted 2004-05-25 08:37:29 »

I'm late on the logging scene - but I am of the understanding that log4j is superior.  It was created before the "inbuilt" logging and I believe was even offered to Sun to use.

The heirachical way log4j works, as well as being able to change settings in config files, code or java arguments is very nice.  To be honest I havn't compared it to Java's logging - I just used it as it seemed to be the industry standard, and I can say that I am a very happy log4j user and am using it in all my current projects now.

If you can present a really good reason to change I'll listen.  Just installing another .jar doesn't cut it for me, if the product is better Smiley

Will.

Offline frdfsnlght

Senior Newbie




Trying to understand


« Reply #2 - Posted 2004-05-25 14:35:02 »

The built in Java logging can also be configured from a file and is also hierarchical. The API is very similar. Log4j's config file is xml, Java's is a properties file. As a result, Java's configs tend to be more compact.

I've used both systems professionally and made the decision that for all my own projects, I'll use the builtin stuff. The differences are so small for me, the fact that I have to have an extra jar file for log4j is a bother.

I'm not trying to start a huge debate here. You're free to use log4j on your own projects. My previous post probably came across as a little testy. It happened after a particlarly frustrating hour (early in the morning) of trying to get odejava to behave in a sensible manner (and failing), then getting the latest version from cvs (hoping maybe I was just hitting some bugs that had been fixed) and trying to build it, only to have the compile fail because I didn't have log4j.

-Tab
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #3 - Posted 2004-05-26 07:39:52 »

can you post a code snippet of what the logs statements look like?

I'll convert if Java's logging is as good, and if it's just a find/replace to change logging libraries.

I use .ini files for my log4j not xml anyway.

Will.

Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #4 - Posted 2004-05-26 11:46:15 »

ok - two features I think are nice about log4j is that it can log stuff to syslog/MS Event log.  It appears Java Logging can't.  This would be very good for server stuff (think - odejava game engine server for eg.)

As I didn't compare the two libraries before using log4j - I did some reasearch.  From what I have read, it seems log4j is better.

reference:
http://www.ingrid.org/jajakarta/log4j/jakarta-log4j-1.1.3/docs/critique.html

Plus, you can use it for pre 1.4 (not an issue with Xith3D, but with other API's it may be).

It seems to me that log4j is the industry standard and for good reason.  I havn't really studied in depth however.

IMHO the small inconvenience of a wget on a .jar file into jre/ext is a pretty minor price to pay for a superior API if indeed it is superior.

Will.

Offline frdfsnlght

Senior Newbie




Trying to understand


« Reply #5 - Posted 2004-05-26 12:29:13 »

Let me just say up front that I'm not making an argument to change the logging in odejava. I can't argue with log4j's extra features, though I've never used them.

But..., grabbing the log4j.jar file is just the beginning.

I prefer not to install libraries using Java's extension mechanism for the simple reason that it's too easy to forget they're not a standard part of the Java dist. I have my own lib directory I install this stuff into and that forces me to deal with the libs in my build.xml and startup scripts. That, in turn, better documents my app's dependencies. I've been bitten too many times to count by "publishing" an application only to have a user install it and not be able to run it because they don't have some component I've been taking for granted. Not only in Java, but Perl, C, etc. I prefer to force myself not to take third party libs for granted.

And even if I wasn't crazy as described in the previous paragraph, I'd have to remember to sign the log4j.jar and include it in the webstart config for my app since the average user will not have downloaded and installed, let alone even heard about, the extra library. Using my technique above doesn't change this, except that my ant build script now explicitly specifies the dependencies, and won't even compile my project without them, so I have a place to go to find them.

Of course, I also use Java3D, which is installed in Java's ext dir by default, which annoys me. That's another can of worms I won't get into now.

And of course all of this is getting dangerously close to the personal philosophies most programmers develop over time and like to defend to their deaths. I'm not trying to convince anyone my way's better. Take it or leave it.

-Tab
Offline dsellars

Junior Member




Need to write more games


« Reply #6 - Posted 2004-05-26 13:43:54 »

I don't know if you saw when I asked about it in "Tools ..."

but just in case you are interested:

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=tools;action=display;num=1084285958


Dan.
Offline frdfsnlght

Senior Newbie




Trying to understand


« Reply #7 - Posted 2004-05-26 14:50:29 »

No, I hadn't seen that one. But now I have, and I even replied Smiley

As was discussed there, I don't think the built-in logging and log4j are interchangable. But the API's are very similar. And here, Will points out a couple of features that the built-in stuff doesn't have (since it violates platform independence, but frankly that's a stupid reason to keep it out in this case IMO).

I'll consider the issue dead. Except for the couple System.out.println's I found in Geom.java that should be replaced with logging statements, if not simply removed altogether. If you're going to do logging, then do logging.

-Tab
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #8 - Posted 2004-05-27 02:01:05 »

interesting other thread.

I agree that using /ext is risky - but that's why it's important to test on a totally untouched system.

I find no matter how hard you try to keep the dev machine clean it's hard.

As for the println's - I agree they need to be removed the only reason they havn't is time.

Will.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (14 views)
2014-08-22 19:31:30

atombrot (28 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (61 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!