logger
logger
Hi,
I noticed after upgrading to the latest nightly 4/21/16, the logging information that had been printing to my screen is now printing to the mcidasv.log. Is there a way to redirect this back to the screen? I am using the python logger module.
Also, I am now getting a core dump from code which was not doing so before updating to latest nightly.
I will send my mcidasv.log to the help desk.
Joleen
I noticed after upgrading to the latest nightly 4/21/16, the logging information that had been printing to my screen is now printing to the mcidasv.log. Is there a way to redirect this back to the screen? I am using the python logger module.
Also, I am now getting a core dump from code which was not doing so before updating to latest nightly.
I will send my mcidasv.log to the help desk.
Joleen
Re: logger
Hi Joleen -
When you said:
... are you referring to screen as the Jython Shell (from a foreground session) or a Terminal window (background script)?
Can you try running the following in the Jython Shell? This should be about as basic as you can get as far as returning logging info to the Jython Shell:
When you run this, do you see the printout go to the Jython Shell and mcidasv.log, or just mcidasv.log?
For us to figure out what happened to your logging output, it would be helpful to know how you have the logging within your script configured. Could you please let us know?
Thanks -
Bob Carp
When you said:
Is there a way to redirect this back to the screen?
... are you referring to screen as the Jython Shell (from a foreground session) or a Terminal window (background script)?
Can you try running the following in the Jython Shell? This should be about as basic as you can get as far as returning logging info to the Jython Shell:
Code: Select all
import logging
logging.getLogger().setLevel(logging.DEBUG)
logging.debug('Testing DEBUG logging')
logging.info('Testing INFO logging')
logging.warning('Testing WARNING logging')
logging.error('Testing ERROR logging')
logging.critical('Testing CRITICAL logging')
When you run this, do you see the printout go to the Jython Shell and mcidasv.log, or just mcidasv.log?
For us to figure out what happened to your logging output, it would be helpful to know how you have the logging within your script configured. Could you please let us know?
Thanks -
Bob Carp
Re: logger
Hi Bob,
I was referring to a script run in background from a unix command line. I don't have problems seeing logging info when running in the foreground jython shell.
Joleen
I was referring to a script run in background from a unix command line. I don't have problems seeing logging info when running in the foreground jython shell.
Joleen
Re: logger
Hi Bob,
The "help" output from the argparse module is also printing to the McIDAS-V.log
Joleen
The "help" output from the argparse module is also printing to the McIDAS-V.log
Joleen
Re: logger
Hi Joleen -
I'm attaching a logback.xml file to this post:
Can you first check your McIDAS-V directory and see if you have a logback.xml file in there? If you do, could you try adding the following lines to it?
If logback.xml does not exist in the McIDAS-V directory, which is the default, put this logback.xml file in your McIDAS-V directory and try your script. Lines 79-81 were added by a programmer to redirect the jython print output to SDTOUT and mcidasv.log. Other than that, this is the default logback.xml file packaged in mcidasv.jar for logging in McIDAS-V.
One note from the programmer if you do have your own logback.xml file:
Using this updated logback.xml file, I'm getting the Jython logging lines to print out to STDOUT and mcidasv.log. Can you please give this a try?
Thanks -
Bob
I'm attaching a logback.xml file to this post:
Can you first check your McIDAS-V directory and see if you have a logback.xml file in there? If you do, could you try adding the following lines to it?
Code: Select all
<logger name="jython" level="INFO" additivity="true">
<appender-ref ref="STDOUT" />
</logger>
If logback.xml does not exist in the McIDAS-V directory, which is the default, put this logback.xml file in your McIDAS-V directory and try your script. Lines 79-81 were added by a programmer to redirect the jython print output to SDTOUT and mcidasv.log. Other than that, this is the default logback.xml file packaged in mcidasv.jar for logging in McIDAS-V.
One note from the programmer if you do have your own logback.xml file:
"if there is a customized version of logback.xml, the (new) lines may not work if the rest of the logging configuration deviates significantly from the default McV logging configuration"
Using this updated logback.xml file, I'm getting the Jython logging lines to print out to STDOUT and mcidasv.log. Can you please give this a try?
Thanks -
Bob
Re: logger
Hi Bob,
I did not have a logback.xml already in my ~/Applications/McIDAS-V-System directory, therefore I just added the file you posted above. This seems to work for me.
Joleen
I did not have a logback.xml already in my ~/Applications/McIDAS-V-System directory, therefore I just added the file you posted above. This seems to work for me.
Joleen
Re: logger
Bob,
When does the logback.xml get created? It seems that when I put a clean install on a new machine, logback.xml does not exist by default?
Joleen
When does the logback.xml get created? It seems that when I put a clean install on a new machine, logback.xml does not exist by default?
Joleen
Re: logger
Hi Joleen -
By default, there's a logback.xml packaged inside of mcidasv.jar (inside the McIDAS-V-System directory) that McIDAS-V uses for its logging. There's no logback file contained in the user's McIDAS-V directory by default. However, the user has the ability to add a logback.xml file to their McIDAS-V directory and McIDAS-V will use this for its logging. In the case of this post, the standard logback.xml file was adjusted to add the following lines:
These lines redirect the Jython print output to STDOUT and mcidasv.log.
The logback.xml file with these lines included is included as an attachment in the post from May 25, 2016 7:30 AM.
Please let me know if you have any questions about this.
Thanks -
Bob
By default, there's a logback.xml packaged inside of mcidasv.jar (inside the McIDAS-V-System directory) that McIDAS-V uses for its logging. There's no logback file contained in the user's McIDAS-V directory by default. However, the user has the ability to add a logback.xml file to their McIDAS-V directory and McIDAS-V will use this for its logging. In the case of this post, the standard logback.xml file was adjusted to add the following lines:
Code: Select all
<logger name="jython" level="INFO" additivity="true">
<appender-ref ref="STDOUT" />
</logger>
These lines redirect the Jython print output to STDOUT and mcidasv.log.
The logback.xml file with these lines included is included as an attachment in the post from May 25, 2016 7:30 AM.
Please let me know if you have any questions about this.
Thanks -
Bob
Re: logger
Hi,
I am not sure when this problem appeared. I have logback.xml in my McIDAS-V documents directory, and I am running
McIDAS-V version 1.7beta1 built 2016-10-31 09:30.
If I use example argparse code:
I will see an error message if I enter the arguments incorrectly when using python directly. For example, entering
I get the message
If I use McIDAS-V:
,
I don't see an error message anywhere. This was not always the case. I am not sure when the changed occured.
(I am running on Mac OSX 10.10)
Joleen
I am not sure when this problem appeared. I have logback.xml in my McIDAS-V documents directory, and I am running
McIDAS-V version 1.7beta1 built 2016-10-31 09:30.
If I use example argparse code:
I will see an error message if I enter the arguments incorrectly when using python directly. For example, entering
Code: Select all
python testargparse.py --food
I get the message
usage: testargparse.py [-h] [--foo FOO]
testargparse.py: error: unrecognized arguments: --food
If I use McIDAS-V:
Code: Select all
~/Applications/McIDAS-V-System/runMcV -script ~/code/test/testargparse.py -scriptargs --food
I don't see an error message anywhere. This was not always the case. I am not sure when the changed occured.
(I am running on Mac OSX 10.10)
Joleen
Re: logger
Hi Joleen -
Thanks for your script and thorough description of the problem, I'm replicating your results. I've written up Inquiry 2444 to address it.
Thanks again -
Bob
Thanks for your script and thorough description of the problem, I'm replicating your results. I've written up Inquiry 2444 to address it.
Thanks again -
Bob