01: /**
02: * $Id: NetFileLogManager.java,v 1.12 2005/11/30 11:26:39 ss150821 Exp $
03: * Copyright 2002 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.netfile.servlet.java2;
14:
15: import com.iplanet.log.LogManager;
16: import com.sun.portal.log.common.PortalLogger;
17: import com.iplanet.log.LogRecord;
18: import com.iplanet.log.LogException;
19: import com.iplanet.sso.SSOToken;
20: import com.sun.portal.netfile.shared.NetFileConstants;
21:
22: import java.util.logging.*;
23:
24: public class NetFileLogManager {
25:
26: private LogManager logMgr = null;
27: private static Logger logger = PortalLogger
28: .getLogger(NetFileLogManager.class);
29:
30: public NetFileLogManager(SSOToken ssoToken) throws Exception {
31: createLog(ssoToken);
32: }
33:
34: public void doLog(String msg) {
35: LogRecord logrec = new LogRecord(
36: NetFileConstants.NF_LOG_FILE_NAME, msg);
37: try {
38: logMgr.write(logrec, NetFileConstants.NF_LOG_FILE_NAME);
39: } catch (LogException le) {
40: // logger.log(Level.SEVERE, "doLog - could not write log message.", le);
41: logger.log(Level.SEVERE, "PSSRNF_CSPNSJ2090");
42: }
43: }
44:
45: private void createLog(SSOToken ssoToken) throws Exception {
46: if (logMgr == null) {
47: logMgr = new LogManager(ssoToken);
48: logMgr.create(NetFileConstants.NF_LOG_FILE_NAME);
49: }
50: }
51:
52: }
|