Hi -
I wanted to move to a better logging mechanism than System.out.println, and decided to go with log4j. But I am having some problems getting it running … I see a couple of posts about it here, but nothing has helped with making it work on this year’s robot.
I tried to go with the ‘new’ version 2, but there appear to be dependencies that I don’t want to deal with - and previous experience with the older version 1 says it will work for our needs.
I modified the userLibs entry in build.properties to get the third party libraries incorporated, and that seems to work - if I untar the FRCUserProgram.jar after a build, there are a bunch of classes in there, which I assume is a correct repackaging of the log4j-1.2.17.jar.
The problem is the configuration file - log4j.properties. I can’t figure out how to get it into the jar file so it shows up for use. I tried looking through the hierarchy of build.xml files for Ant in the WPILib stuff - but don’t know enough about Ant to find out how.
So I decided to just copy it over to the lvuser home directory, since that seems to be the default classpath for the execution of the script that actually runs the built jar file. But I get log4j warnings about the initialization process; including some exceptions about a Java class not found for “java/beans/IntrospectionException” - which I assume is because the version of Java we run on the roboRIO is missing what a ‘normal’ SDK has.
At this point my log4j.properties is pretty basic - just a simple console appender for output. So I’m assuming that isn’t the problem.
If I use the BasicConfigurator, I still get the warning and the NoClassDefFoundException, but it sort of runs - as I get my formatted log messages to the NetConsole … I just can’t control the output.
If someone who has gotten this working could give me some help, I would greatly appreciate it!
Thanks in advance!
Stu