Page 1 of 2

Disable logging specific TI process in tm1s-log.properties

Posted: Thu Mar 03, 2016 9:40 am
by nlashin
Hello everyone!

I have a TI process which running in a chore every minute.

Of course, this makes too much logging in tm1serve.log . But I can't disable all processes or chores by setting:
log4j.logger.TM1.Process=OFF
log4j.logger.TM1.Chore=OFF

Can I specify TI process there ( log4j.logger.TM1.Process.MyProcess=OFF )? Or may be you have any other suggestions?

Thanks!

Best Regards, Nikita

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Thu Mar 03, 2016 10:22 am
by qml
No, you can't stop logging a specific chore/process.

What you could do is log all TI process related information into a separate file so that your main server log is not cluttered with any TI process entries whatsoever. Let me know if you'd like instructions on how to achieve that.

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Thu Mar 03, 2016 12:22 pm
by tomok
qml wrote:What you could do is log all TI process related information into a separate file so that your main server log is not cluttered with any TI process entries whatsoever. Let me know if you'd like instructions on how to achieve that.
I'd like to know how to do that. ;)

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Thu Mar 03, 2016 1:26 pm
by qml
Very well then, here is an example of a tm1s-log.properties file that would do just that:

Code: Select all

log4j.logger.TM1.Process=INFO, S9
log4j.logger.TM1.Chore=INFO, S9

log4j.appender.S9=org.apache.log4j.SharedMemoryAppender
log4j.appender.S9.MemorySize=20485760
log4j.appender.S9.MaxFileSize=20 MB
log4j.appender.S9.File=tm1process.log
log4j.appender.S9.MaxBackupIndex=9
log4j.appender.S9.TimeZone=GMT

log4j.additivity.TM1.Process=false
log4j.additivity.TM1.Chore=false
The last two lines are there specifically so that these two loggers (TM1.Process and TM1.Chore) write only to tm1process.log and not to the main tm1server.log.

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Thu Mar 03, 2016 1:50 pm
by Elessar
Nikita,

I wonder, WHY do you need to run a process every minute?..

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Thu Mar 03, 2016 4:06 pm
by TrevorGoss
Elessar wrote:Nikita,

I wonder, WHY do you need to run a process every minute?..
Before we upgraded to 10.2 We had a trigger inside an Application that allowed the user to change a value in a Picklist, so the chore running every minute can see the "run in the next minute" value, and run a transfer process.

We now just use the event handling set up in Application Web, via Performance Modeler.

He might have something similar....

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Sun Mar 06, 2016 4:00 pm
by nlashin
qml wrote:The last two lines are there specifically so that these two loggers (TM1.Process and TM1.Chore) write only to tm1process.log and not to the main tm1server.log.
Thanks, i'll use this way.
Elessar wrote:Nikita,

I wonder, WHY do you need to run a process every minute?..
I check whether file exists in a special folder or not, and if exists, I start loading process.

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Sun Mar 06, 2016 6:45 pm
by gtonkin
Sounds like a scenario to use task scheduler and TM1RunTI (some batch file/vbs code) Only if the file exists would you need to run the TI. In this case you would want TI to write to the TM1Server.log
Alternatively, trigger the TM1RunTI from the application creating the file.

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Wed Mar 09, 2016 8:18 am
by nlashin
gtonkin wrote:Sounds like a scenario to use task scheduler and TM1RunTI (some batch file/vbs code) Only if the file exists would you need to run the TI. In this case you would want TI to write to the TM1Server.log
Alternatively, trigger the TM1RunTI from the application creating the file.
Good idea! But I haven't got access to this application (ERP system) and it is difficult to push it make a trigger. :(

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Wed Mar 09, 2016 6:17 pm
by gtonkin
Hi Nikita, was thinking of running the polling process on the TM1 server, instead of the chore running each minute. The polling process would be called from Windows task scheduler. Should be ERP file be present then the TM1RunTi would be executed.

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Sun Mar 13, 2016 8:58 am
by nlashin
gtonkin wrote:Hi Nikita, was thinking of running the polling process on the TM1 server, instead of the chore running each minute. The polling process would be called from Windows task scheduler. Should be ERP file be present then the TM1RunTi would be executed.
Sounds interesting. I think, I'll try :) Thank you!

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Tue Mar 15, 2016 3:55 pm
by Hippogriff
qml wrote:Very well then, here is an example of a tm1s-log.properties file that would do just that:

Code: Select all

log4j.logger.TM1.Process=INFO, S9
log4j.logger.TM1.Chore=INFO, S9

log4j.appender.S9=org.apache.log4j.SharedMemoryAppender
log4j.appender.S9.MemorySize=20485760
log4j.appender.S9.MaxFileSize=20 MB
log4j.appender.S9.File=tm1process.log
log4j.appender.S9.MaxBackupIndex=9
log4j.appender.S9.TimeZone=GMT

log4j.additivity.TM1.Process=false
log4j.additivity.TM1.Chore=false
The last two lines are there specifically so that these two loggers (TM1.Process and TM1.Chore) write only to tm1process.log and not to the main tm1server.log.
I thought this was a great idea. I wanted to see whether I could get all my own debug output into a separate file - from LogOutput function calls in TI Processes - and I tried to add this extra section to the tm1s-log.properties file, cribbing from the above:

Code: Select all

# Second Logger just for TILogOutput entries...
log4j.logger.TM1.TILogOutput=INFO, S9
log4j.appender.S9=org.apache.log4j.SharedMemoryAppender
log4j.appender.S9.MemorySize=5 MB
log4j.appender.S9.MaxFileSize=100 MB
log4j.appender.S9.File="C:\TILogOutput.log"
log4j.appender.S9.MaxBackupIndex=20
log4j.appender.S9.TimeZone=GMT
log4j.additivity.TM1.TILogOutput=false
...but I've now ended up in the situation where, when I run a Process that has numerous LogOutput calls in it, these output lines no longer appear in the tm1server.log (whereas they did before, with a TM1.TILogOutput prefix) but the file C:\TILogOutput.log is never created. Now I just see:

Code: Select all

TM1.Process   Process "A_Test" executed by user "Admin"
TM1.Process   Process "A_Test":  finished executing normally, elapsed time 0.00 seconds
In the tm1server.log. I'm bemused by that. Obviously missing something. Any pointers gratefully received on this. I can get my LogOutput log lines back into tm1server,log if I remove this stuff I put in, so it's obviously heeding the instruction to either do or do not to write them to tm1server.log, it's just not writing to the other log as I'd like it to.

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Tue Mar 15, 2016 4:13 pm
by qml
Hippogriff wrote:I'm bemused by that. Obviously missing something. Any pointers gratefully received on this. I can get my LogOutput log lines back into tm1server,log if I remove this stuff I put in, so it's obviously heeding the instruction to either do or do not to write them to tm1server.log, it's just not writing to the other log as I'd like it to.
Looks like it should work, because it most certainly does for any other logger I have tried. It's possibly that either TM1.TILogOutput has a defect in handling the additivity property (it is after all a relatively new logger), or that this is the intended behaviour and the makers of that logger wanted to only allow writing to the main tm1server.log for some reason.

It could also be that the service account TM1 is running under cannot write to C:\ so maybe try using TM1's logging directory as the location for your log?

If it's not a permissions issue I suggest raising a PMR with IBM for this.

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Tue Mar 15, 2016 6:40 pm
by BrianL
Hippogriff wrote:

Code: Select all

# Second Logger just for TILogOutput entries...
log4j.logger.TM1.TILogOutput=INFO, S9
log4j.appender.S9=org.apache.log4j.SharedMemoryAppender
log4j.appender.S9.MemorySize=5 MB
log4j.appender.S9.MaxFileSize=100 MB
log4j.appender.S9.File="C:\TILogOutput.log"
log4j.appender.S9.MaxBackupIndex=20
log4j.appender.S9.TimeZone=GMT
log4j.additivity.TM1.TILogOutput=false
Remove the quotes from around the File parameter and use a double backslash for the path separator.

Code: Select all

log4j.appender.S9.File=C:\\TILogOutput.log

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Wed Mar 16, 2016 10:14 am
by Hippogriff
Thanks to both - it was the "\\" I needed - rookie error.

Although "/" also works as a replacement for "\".

It does not like the double-quotes, seemingly.

It's working with just TILogOutput going to a separate file.

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Thu Mar 17, 2016 5:25 pm
by Bakkone
Quick question from a fairly new guy.

If I wanted to learn about configuring logging. What would I google?

I understand that TM1 has this logger. And you can configure this logger to do things. But I cant seem to find what available commands there are.

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Thu Mar 17, 2016 5:32 pm
by gtonkin
IBM sent this article out last night as it happens.

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Thu Mar 17, 2016 5:34 pm
by qml
Bakkone wrote:If I wanted to learn about configuring logging. What would I google?
You can start with the overview here.

And if you use the search box on this forum and look for something like 'tm1s log properties' you should find many threads on the subject and some useful loggers. If you're further interested you can also google 'log4j' as this is the open source logging library that TM1 uses.

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Tue Mar 22, 2016 4:26 pm
by Bakkone
Thanks! I will look into it.

Re: Disable logging specific TI process in tm1s-log.properties

Posted: Fri May 06, 2016 10:02 am
by Hippogriff
Do you think it's true that a specific Logger can only have 1 level (and above) enabled?

I wrote this small TI Process:

Code: Select all

LogOutput ('DEBUG','DEBUG - Line 1');
LogOutput ('INFO','INFO - Line 2');
LogOutput ('WARN','WARN - Line 3');
LogOutput ('ERROR','ERROR - Line 4');
LogOutput ('FATAL','FATAL - Line 5');
I wanted to reach the point where I could have all 5 lines going into tm1server.log and just ERROR and above going into a new errorsonly.log - for the life of me I cannot get this to happen.

My thinking was that I would set the S1 Appender to be DEBUG. When I do that, and run the Process, I certainly see all 5 lines echoed out to tm1server.log. I then thought I could create a second Appender (S2?) and that would point to a different file, but its level would be set to ERROR so I should get only ERROR and FATAL output there.

I thought that this would work:

Code: Select all

log4j.logger.TM1=INFO, S1
log4j.appender.S1=org.apache.log4j.SharedMemoryAppender
log4j.appender.S1.MemorySize=5 MB
log4j.appender.S1.MaxFileSize=100 MB
log4j.appender.S1.MaxBackupIndex=20
log4j.appender.S1.TimeZone=GMT

log4j.logger.TM1=ERROR, S2
log4j.appender.S2=org.apache.log4j.SharedMemoryAppender
log4j.appender.S2.MemorySize=5 MB
log4j.appender.S2.MaxFileSize=100 MB
log4j.appender.S2.File=C:/TM1LOGGING/errorsonly.log
log4j.appender.S2.MaxBackupIndex=20
log4j.appender.S2.TimeZone=GMT
log4j.additivity.TM1.S2=true
But what I see here is that tm1server.log is not written to at all, and the ERROR and FATAL lines are written to errorsonly.log. It's like the Logger TM1 can only have 1 LEVEL set, regardless of which Appender we may be talking about.

So I added TILogOutput to the S2 Appender, like so:

Code: Select all

log4j.logger.TM1=INFO, S1
log4j.appender.S1=org.apache.log4j.SharedMemoryAppender
log4j.appender.S1.MemorySize=5 MB
log4j.appender.S1.MaxFileSize=100 MB
log4j.appender.S1.MaxBackupIndex=20
log4j.appender.S1.TimeZone=GMT

log4j.logger.TM1.TILogOutput=ERROR, S2
log4j.appender.S2=org.apache.log4j.SharedMemoryAppender
log4j.appender.S2.MemorySize=5 MB
log4j.appender.S2.MaxFileSize=100 MB
log4j.appender.S2.File=C:/TM1LOGGING/RandomTesting/errorsonly.log
log4j.appender.S2.MaxBackupIndex=20
log4j.appender.S2.TimeZone=GMT
log4j.additivity.TM1.S2=true
Hoping that I would then get INFO, WARN, ERROR and FATAL into tm1server.log and just ERROR and FATAL into errorsonly.log but I do not - I observe it writing to both logs, but it writes only the ERROR and FATAL to both - my desire to have the other LEVELs written to tm1server.log ain't happening.

If I set Appenders S1 and S2 to be log4j.logger.TM1.TILogOutput then I'm kinda back to where I started - tm1server.log contains nothing, and errorsonly.log contains the lines for ERROR and FATAL only.

Do you think my expectations of how this could work are out-of-whack or am I missing something else I need?