ACS Course ACS logging in Java H Sommer

  • Slides: 6
Download presentation
ACS Course ACS logging in Java H. Sommer NRAO - Socorro July, 2004

ACS Course ACS logging in Java H. Sommer NRAO - Socorro July, 2004

Plain JDK Logger with ACS behind the scenes ALMA Project Application code (component or

Plain JDK Logger with ACS behind the scenes ALMA Project Application code (component or comp-client) get. Logger uses java. util. logging. Logger • info(String msg) • log(Level, String msg, Throwable) Container. Services#get. Logger() creates & configures forwards messages VM-local ACS log handler 19. November 2002 forwards (XML) remote ACS logging service Central log display 2

Code Snippets from jcontexmpl/Hello. Lamp. Impl ALMA Project m_logger. info("say. Hello called. . .

Code Snippets from jcontexmpl/Hello. Lamp. Impl ALMA Project m_logger. info("say. Hello called. . . "); catch (Exception ex) { m_logger. log(Level. SEVERE, "ex in set. Lamp. Brightness impl", ex); } 19. November 2002 3

JDK Logging API ALMA Project • Standard since JDK 1. 4 • Easy API

JDK Logging API ALMA Project • Standard since JDK 1. 4 • Easy API (you’ll only need the Logger class) – short methods with level names (finest, . . . info, warning, severe) each taking a message string. – More powerful methods log, logp, for logging of values etc. • Flexible configuration for filtering and formatting (done by ACS) • Automatic retrieval of method names, line numbers etc (not guaranteed to work always for all VMs though…) • API: http: //java. sun. com/j 2 se/1. 4. 2/docs/api/java/util/logging/package-summary. html • More info: http: //java. sun. com/j 2 se/1. 4. 2/docs/guide/util/logging/overview. html 19. November 2002 4

ACS logging configuration ALMA Project • Standard configuration file used: module acsjlog/src/almalogging. properties acs.

ACS logging configuration ALMA Project • Standard configuration file used: module acsjlog/src/almalogging. properties acs. Start. Container –java frodo. Container • User may specify different properties file: abeans. Start -endorsed -Djava. util. logging. config. file= /x/y/mylogging. properties frodo. Container • Suppress log levels below INFO (or any other level): alma. acs. logging. Acs. Logging. Handler. level = INFO • Console output level controlled by separate property: java. util. logging. Console. Handler. level = INFO 19. November 2002 5

Future of Java ACS Logging ALMA Project • The Logger returned from Container. Services#get.

Future of Java ACS Logging ALMA Project • The Logger returned from Container. Services#get. Logger is already configured with a “logger-namespace” unique for the Java component that requests it. • We could extend that namespace concept to group or filter log entries by the components that produced them • Log levels for suppressing unimportant messages could be set dynamically, e. g. by the Administrator Client; individually for all components and containers in the system… 19. November 2002 6