subscribername parameter in m2ee loglevel command

1
From command line I get this instruction on a Linux server: To adjust loglevels, use: loglevel <subscribername> <lognodename> <level> Lognodename and level are clear, but what do I have to fill in on subscribername? I tried a random string but that throws an exception
asked
3 answers
3

For every lognode (ie: webservices, xmlimporter, jetty, microflowengine) there are one or more subscribers. These subscribers receive messages from those lognodes and then log them to wherever. For instance, the SysLogSubscriber takes messages and passes them to /var/log/xas2/appname.log (for the mendix hosted environment)

You can configure extra subscribers in your m2eerc file.

If you want to set the loglevel for a particular lognode, the command format is: loglevel <subscribername> <lognodename> <level>

An example would be:

loglevel SysLogSubscriber Webservices TRACE

to get webservices to log all TRACE messages (and higher) to the syslog.

Note that you can easily get a list of logsubscribers and lognodes by typing "loglevel" (as michel noted)

answered
2

Some more background info:

Logging inside the mendix runtime is set up using a publish / subscribe pattern. The LogNode objects you see when logging from java actions are the nodes you can use to publish messages to. Subscribers can choose what messages they want to receive.

LogNodes (sometimes called 'channels' in pubsub) will be created on the fly in mendix when you publish a log message to them for the first time (to be precise, when you Core.getLogNode them).

By default, a LogSubscriber is configured in your application settings (in your case, it's the SyslogSubscriber which just forwards everything to a local running linux syslog daemon). A LogSubscriber can be configured with an 'autosubscribe' parameter, specifying at which log level it will be added as subscriber to all future dynamically created log nodes. This autosubscribe level is specified in your m2ee.yaml (or m2eerc) configuration file.

Using the loglevel commands in the m2ee tools, you can remotely change the loglevels of the logsubscribers in your application. Don't forget to put them back from debug or trace to info when you're done debugging. :-)

The primary purpose of the pub/sub system is application logging, but if you like to do some mendix hacking in java, you could use it to build a simple messaging system, or event-based processing layer in your application. The log system has a public api to implement and register custom LogSubscriber classes you can create in Java.

Anyway, I wouldn't recommend doing this in a bigger project, because it adds complexity that is not visible in the modeler, but if you're looking for somewhat hidden funny things inside mendix to play with... :-)

To prevent existing (unwanted) logsubscribers from autosubscribing to your custom lognodes, you can then disable autosubscribe on the lognode, if you explicitely create the lognode using the createLogNode api call.

Hmmmmmz, it looks the public ILogNode createNode(String name, boolean autosubscribe); in com.mendix.m2ee.log.ILogManager is flagged deprecated in recent 2.5 releases. :-( I'll file a bug/feature report about that, to end this friday-night-mendix-internals session. ;-]

answered
-1
m2ee(pcp): loglevel
Current loglevels:
SysLogSubscriber Jetty INFO

Take a guess :-D.

answered