[
https://issues.apache.org/jira/browse/PIG-83?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Benjamin Francisoud updated PIG-83:
-----------------------------------
Attachment: PIG-83-v02.patch
patch to use java.util.logging
*Modifications*
* Replaced System.out.println with logger.info
* Replaced System.err.println with logger.warning (since there is no error
level in java logging)
* Deleted PigLogger (which was using log4j) and replace every call by
java.util.logging
* Replaced PigLogger.fatal with logger.severe (which is the highest log level
in java logging)
* Replaced PigLogger.error with logger.warning
* The only method I could find in the api to log a full stacktrace was
logger.log(Level.XXX, e.getMessage(), e); (java logging api sucks in my opinion)
* removed options in the command line tool to set log level since java logging
api specify that it(s the user who is in charge of specifying a
logging.properties file (see Configuration below)
*Special cases*
Exception in 2 classes where the system.out are for command line help or usage
printing:
* Left Main.usage()
* GruntParser#printHelp()
*Configuration*
>From java logging documentation:
* [JavaTM Logging Overview - chapt 1.8 Configuration
File|http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/overview.html#1.8]
" The logging configuration can be initialized using a logging configuration
file that will be read at startup. This logging configuration file is in
standard java.util.Properties format."
" The default logging configuration that ships with the JRE is only a default,
and can be overridden by ISVs, system admins, and end users."
* [LogManager
Api|http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/LogManager.html]
" If "java.util.logging.config.class" property is not set, then the
"java.util.logging.config.file" system property can be used to specify a
properties file (in java.util.Properties format). The initial logging
configuration will be read from this file.
If neither of these properties is defined then, as described above, the
LogManager will read its initial configuration from a properties file
"lib/logging.properties" in the JRE directory. "
*To use and configure* logging level, output etc...
You need to either:
* change "lib/logging.properties" in the JRE directory
* set a -Djava.util.logging.config.file=/pig/trunk/logging.properties
I will provide an example configuration file (a modify version of a [jpox
conf|http://www.jpox.org/docs/1_2/logging.html])
> logging abstraction
> -------------------
>
> Key: PIG-83
> URL: https://issues.apache.org/jira/browse/PIG-83
> Project: Pig
> Issue Type: Wish
> Reporter: Stefan Groschupf
> Attachments: log4j.properties, logging.properties, PIG-83-v01.patch,
> PIG-83-v02.patch
>
>
> Pig is logging quite a lot into System.out or System.err. Using a embedded
> pig in a production environment requires a logging abstraction like log4j,
> commons logging, slf4j or something like that.
> I would be happy to work on a patch if we decide what would be the best
> choice. Hadoop uses log4j.
> Thanks.
> Stefan
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.