Hi William -

You should be able to use the InstallLogger. The DC was able to modify it It creates its own logging files. Here is a sample of what they did:

global DC_LOGGER
DC_LOGGER = logging.getLogger(INSTALL_LOGGER_NAME)

# set the logfile name
log_name = "log.%s" % time.strftime("%Y-%m-%d.%H:%M")
detail_log_name = "detail-%s" % log_name
simple_log_name = "simple-%s" % log_name

# create an additional FileHandler for a simple log
base, logfile = os.path.split(DEFAULTLOG)
simple_logname = os.path.join(base, "simple-" + logfile)
simple_fh = FileHandler(simple_logname)
simple_fh.setLevel(logging.INFO)
DC_LOGGER.addHandler(simple_fh)

Through the installLogger, when adding a handler, the format has a
default unless another is applied to the handler. So the format can be
modified.

When you invoke the InstallLogger, you get the default log and the
default format, but you can add additional handlers to fit your needs.

During the design, Sarah wanted there to be defaults that were not able
to be modified. Thus the hardcoded location of the log. If the defaults
don't work for a situation, it would make sense to see what needs to be
done to make it more flexible.

On 01/17/11 10:42, William Schumann wrote:
Dave, responding to your logging comments below.

On 01/12/11 09:51 PM, Dave Miner wrote:
On 12/21/10 11:32 AM, William Schumann wrote:
Requesting code review for enhancements for service configuration
profiles in the Automated Installer.
http://cr.opensolaris.org/~wmsch/profile/

...
45, 46, others: I'm skeptical of having our own log rotation going on here. logadm is the general facility in Solaris for administrators to control log rotation and I'd prefer to see that used since it provides a way for them to express their preferred policy, which doesn't seem to be supported here. Also, I'm somewhat surprised that this isn't using InstallLogger, but perhaps there's a reason that's not suitable somehow?
The InstallLogger class from solaris_install/logger.py was written for the install environment on the install target, and not the installadm UI nor an AI server CGI (e.g., logfile is hard-coded for /var/tmp, formatting method seems to be intended only for the Transfer phase logging, hardcoded formatter, etc.).

However, logger.py does seem to be a more appropriate place for new AI server-side logging code than common_profile.py.

To substitute logadm for the RotatingFileHandler, I think it could be accomplished like this: - if an /etc/logsvc.conf record for installadm logfile did not exist, installadm would append one, leveraging fmadm(1M) with some defaults - replace RotatingFileHandler with a non-rotating logging handler like logger.py's FileHandler, which is a class derived from the Python logging.FileHandler class (needs some exception handling for failure to create log directory or log file)

You would be able to do that with code similar to what I've included above.

ginnie



William
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss

Reply via email to