3

I'm building a desktop app with a Java front-end and very performance critical Fortran libraries. We've recently started pushing more of our code out of Java and into Fortran (see below)

Soon we will likely have modules in SCALA (using akka.io or JPPF's distributed computing system).

I'm wondering what I can do to try to ensure sane, consolidated, properly formatted logs. Right now our fairly extensive java front-end is using java.util.logging (JUL). As I'm sure many of you have also dealt with, bootstrapping our loggers configuration is already a more complex process than I would like it to be, and is devoid of automated testing.

Our Fortran binaries, as per the default behavior of Intel Fortran libraries, occasionally murmur things to standard out, that simply get forgotten when our code is deployed. I would very much like that stuff to show up in much the same format that a JUL logger.log() call would.

How would I go around polyglot logging, so that I can capture the warnings/errors emitted by non-JUL and/or non-JVM code, and still get it into one file that's nicely formatted.

re: Fortran? really!?

  • thats a dead programming language! you're insane!!
    • the latest version of fortran is 2015, with intel releasing a new version in 2018. Because of its C-binding nature it binds to JNA/JNI just as easily as native code.
  • but why do you need performance, premature optimization is the root of all evil!
    • well aware, but yes, after spending a fair bit of time optimizing our java code and going after the fastest libraries we could, some basic linear algebra was not still noticably slower in java than in fortran, and some operations are simply only available through intel's MKL
1

I'm unfamiliar specifically with JUL but I have had reasonable success using the m_multilog module from Arjen Markus' flibs package - see http://flibs.sourceforge.net/m_multilog.html I modified it to use syslog-style severity classes; the results are reasonably easy to parse into timestamp, severity class, and log message body.

If latency isn't a huge problem, it's probably easiest to log to a file and periodically read it into your main log handling system, Otherwise, if 'live' logging is needed, you may be stuck linking to an external logging library via the iso_c_bindings mechanism.

Either way, I believe flibs is released under a form of the BSD license. You should be able to crowbar the m_multilog module into writing logs your log processor can understand. Sucks that there's effectively no standard library for Fortran; it could really use basic facilities like logging, CSV/JSON/XML support, regex libraries for input processing, etc. etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.