At this point given our usage of implicit cursoring, a procedure language level enhancement would be most appropriate. Having a procedure or log function would cause the implicit return cursor to be set from that statement.
So we would have something like:
OUTPUT LOG [level] [context] message
The OUTPUT reserved word would be needed to disambiguate the parsing. level could be integral, or the Log4j level mnemonics, or the jre Level mnemonics. it would default to the appropriate debug level. Context would be a string and default to org.teiid.PROCESSOR
We could make the message expression evaluation contingent upon whether the log will actually be recorded. But we'd probably also have to add a boolean system function for more complicated scenarios:
IF (isLoggable(level, context))
BEGIN
//complex concat of message
OUTPUT LOG ....
END
The logs would then be delivered to the underlying log4j logging system.
Any thoughts?
> Just an observation from my first use, I'm not a fan of it.
It's all a matter of perspective. One could equally assert that littering your procedure or java code with System.outs is not a great idea. At worst you have to go back and remove them and/or convert them into proper logging statements. Perhaps your requirement is for a simpler way to control logging or to have a default logger (org.teiid.console or whatever name makes sense) configured that is already routed to the console: CALL logMsg(msg=>'foo' context=>'org.teiid.console')