1 2 3 4 5 6 7 8 9 10 11 12 13 14 package org.jahia.utils; 15 16 import javax.servlet.GenericServlet ; 17 18 public class JahiaConsole { 19 20 private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(JahiaConsole.class); 21 22 25 public static final int DEFAULT_LOGGING_LEVEL = 3; 26 public static final int MAX_LOGGING_LEVEL = 10; 27 public static final int CONSOLE_LOGGING_LEVEL = 9; 28 31 32 private static String prefix = "Jahia > "; 33 private static GenericServlet servlet = null; 34 private static int currentLoggingLevel = 0; 35 36 37 42 private JahiaConsole() 43 { 44 println( "JahiaConsole", "***** Starting Jahia Console" ); 45 } 47 48 public static void setServlet(GenericServlet servletRef) { 49 servlet = servletRef; 50 } 51 52 public static void setLoggingLevel(int level) { 53 currentLoggingLevel = level; 54 } 55 56 61 public static void print( String origin, String msg ) 62 { 63 logger.debug(origin + " > " + msg); 64 65 72 } 74 75 80 public static void println( String origin, String msg ) 81 { 82 83 logger.debug(origin + "> " + msg); 84 94 } 96 104 public static void printe( String origin, Throwable t ) { 105 logger.debug(origin, t); 106 121 } 122 123 128 public static synchronized void finalPrintln( String origin, String msg ) 129 { 130 logger.info(origin + "> " + msg); 131 } public static synchronized void finalPrint( String origin, String msg ) 134 { 135 logger.info(origin + "> " + msg); 136 } 139 140 141 146 public static void startup( int buildNumber ) 147 { 148 String msg = ""; 149 msg += "***********************************\n"; 150 msg += " Starting Jahia - Build " + buildNumber + "\n"; 151 msg += " \"Today's a great day ! \"\n"; 152 msg += "***********************************\n"; 153 JahiaConsole.println("JahiaConsole.startup","\n\n" + msg + "\n" ); 154 println( "Jahia", "***** Starting Jahia *****" ); 155 } 157 158 159 164 public static void startupWithTrust( int buildNumber ) 165 { 166 Integer buildNumberInteger = new Integer (buildNumber); 167 String buildString = buildNumberInteger.toString(); 168 StringBuffer buildBuffer = new StringBuffer (); 169 170 for(int i=0; i < buildString.length(); i++) { 171 buildBuffer.append(" "); 172 buildBuffer.append(buildString.substring(i, i+1)); 173 } 174 175 StringBuffer msg = new StringBuffer ("\n\n\n\n"); 176 msg.append (" ____.\n"); 177 msg.append (" __/\\ ______| |__/\\. _______\n"); 178 msg.append (" __ .____| | \\ | +----+ \\\n"); 179 msg.append (" _______| /--| | | - \\ _ | : - \\_________\n"); 180 msg.append (" \\\\______: :---| : : | : | \\________>\n"); 181 msg.append (" |__\\---\\_____________:______: :____|____:_____\\\n"); 182 msg.append (" /_____|\n"); 183 msg.append ("\n"); 184 msg.append (" . . . s t a r t i n g j a h i a b u i l d " + buildBuffer.toString() + " . . .\n"); 185 msg.append ("\n\n"); 186 msg.append (" Copyright 2002-2007 - jahia http://www.jahia.org - all rights reserved\n"); 187 msg.append ("\n\n"); 188 msg.append (" **************************************************************************\n"); 189 msg.append (" * The contents of this file, or the files included with this file, are *\n"); 190 msg.append (" * subject to the current version of JAHIA Community Source License for *\n"); 191 msg.append (" * the Jahia Portal Server (the \"License\"); You may not use this file *\n"); 192 msg.append (" * except in compliance with the License. You may obtain a copy of the *\n"); 193 msg.append (" * License at http://www.jahia.org. See the License for the rights, *\n"); 194 msg.append (" * obligations and limitations governing use of the contents of the file. *\n"); 195 msg.append (" * The Original and Upgraded Code is the Jahia Portal Server. The *\n"); 196 msg.append (" * developer of the Original and Upgraded Code is JAHIA Ltd. JAHIA Ltd. *\n"); 197 msg.append (" * owns the copyrights in the portions it created. All Rights Reserved. *\n"); 198 msg.append (" **************************************************************************\n"); 199 msg.append ("\n\n"); 200 201 System.out.println (msg.toString()); 202 System.out.flush(); 203 } 205 } 206 | Popular Tags |