001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.report; 029 030import org.opencms.i18n.CmsMessageContainer; 031import org.opencms.main.CmsLog; 032 033import java.util.Locale; 034 035import org.apache.commons.logging.Log; 036 037/** 038 * Report for shell which writes to LOG.<p> 039 */ 040public class CmsShellLogReport extends CmsShellReport { 041 042 /** The log object for this class. */ 043 private static final Log LOG = CmsLog.getLog(CmsShellLogReport.class); 044 045 /**Line to write in LOG. */ 046 private String m_line = ""; 047 048 /** 049 * public constructor.<p> 050 * 051 * @param locale locale 052 */ 053 public CmsShellLogReport(Locale locale) { 054 055 super(locale); 056 057 } 058 059 /** 060 * @see org.opencms.report.A_CmsReport#print(org.opencms.i18n.CmsMessageContainer) 061 */ 062 @Override 063 public void print(CmsMessageContainer container) { 064 065 super.print(container); 066 m_line += (container.key()); 067 } 068 069 /** 070 * @see org.opencms.report.A_CmsReport#print(org.opencms.i18n.CmsMessageContainer, int) 071 */ 072 @Override 073 public void print(CmsMessageContainer container, int format) { 074 075 super.print(container, format); 076 m_line += (container.key()); 077 } 078 079 /** 080 * @see org.opencms.report.CmsPrintStreamReport#println() 081 */ 082 @Override 083 public void println() { 084 085 super.println(); 086 LOG.info(m_line); 087 m_line = ""; 088 } 089 090 /** 091 * @see org.opencms.report.A_CmsReport#println(org.opencms.i18n.CmsMessageContainer) 092 */ 093 @Override 094 public void println(CmsMessageContainer container) { 095 096 super.println(container); 097 m_line += container.key(); 098 LOG.info(m_line); 099 m_line = ""; 100 } 101 102 /** 103 * @see org.opencms.report.A_CmsReport#println(org.opencms.i18n.CmsMessageContainer, int) 104 */ 105 @Override 106 public void println(CmsMessageContainer container, int format) { 107 108 super.println(container, format); 109 110 m_line += container.key(); 111 LOG.info(m_line); 112 m_line = ""; 113 } 114 115 /** 116 * @see org.opencms.report.A_CmsReport#printMessageWithParam(org.opencms.i18n.CmsMessageContainer, java.lang.Object) 117 */ 118 @Override 119 public void printMessageWithParam(CmsMessageContainer container, Object param) { 120 121 super.printMessageWithParam(container, param); 122 123 m_line += container.key(); 124 } 125 126 /** 127 * @see org.opencms.report.A_CmsReport#printMessageWithParam(int, int, org.opencms.i18n.CmsMessageContainer, java.lang.Object) 128 */ 129 @Override 130 public void printMessageWithParam(int m, int n, CmsMessageContainer container, Object param) { 131 132 super.printMessageWithParam(m, n, container, param); 133 m_line += container.key(); 134 } 135 136}