Monday, April 23, 2012

How to track style problems in NatJet

In NatJet style sheets can be quite tricky and you may enter an error in it.

  • If a style contains an error, the graphical element will be incorrectly displayed by the designer.
  • If the error breaks the XML syntax, no style will be applied in the designer. The panel will be displayed with no style.

Identifying the cause of the problem may be quite difficult especially in the second case.

Hopefully you can activate the log of the designer in NatJet 4. In NatJet 5, the log should already be activated.

NatJet Designer Log file

The log file can be found in the sub folder eclipse of your NatJet directory (where it has been installed). For example it could be C:\NatJet5.0.0\eclipse.

The name of the file is natjet-designer.log.

Activating log for the designer

In subfolder eclipse\plugins of your NatJet installation, you should have a folder with its name starting with fr.natsystem.natjet.graphicaldesigner_.

If you enter this subfolder, you should see a log4j.properties file. This file allows configuration of the way the graphical designer log error.

The first line maybe in NatJet 4.0 :

log4j.rootCategory=WARN, console

If you want to trace error, you should replace it by :

log4j.rootCategory=INFO, nslogFile

Then the complete log4j.properties file should be :

log4j.rootCategory=INFO, nslogFile
log4j.appender.nslogFile=org.apache.log4j.RollingFileAppender
log4j.appender.nslogFile.File = natjet-designer.log
##log4j.appender.nslogFile.FilteredLevel=INFO,ERROR,DEBUG,TRACE,FATAL
log4j.appender.nslogFile.MaxBackupIndex=20
log4j.appender.nslogFile.layout=org.apache.log4j.PatternLayout
log4j.appender.nslogFile.layout.ConversionPattern=%d{ISO8601} [%-10t] - %m%n

 
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Threshold=DEBUG
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%c %d{ISO8601} -- %p -- %m%n

Conclusion

You know how to activate log for the designer and where to look at if you get a problem.

Notice, that so far, in 3 years, I’ve only need it once, and it was on a alpha version.