1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
|
/*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) radix(10) lradix(10)
// Source File Name: DashoA10*..
package com.sciforma.psnext.util;
import com.sciforma.psnext.framework.*;
import com.sciforma.psnext.servlet.PSServlet;
import java.io.*;
import java.text.MessageFormat;
import java.util.*;
import javax.servlet.ServletContext;
import org.apache.log4j.*;
import org.apache.log4j.spi.*;
// Referenced classes of package com.sciforma.psnext.util:
// ErrorProcessing, Util, ExtResourceBundle
public class Log extends Logger
{
static class ErrHandler
implements ErrorHandler
{
public void error(String s, Exception exception, int i)
{
Log.a(true);
Log.d(s + ": " + exception.getMessage());
a.error(s, exception, i);
}
public void error(String s)
{
Log.a(true);
Log.d(s);
a.error(s);
}
public void error(String s, Exception exception, int i, LoggingEvent loggingevent)
{
Log.a(true);
Log.d(s + ": " + exception.getMessage());
a.error(s, exception, i, loggingevent);
}
public void setLogger(Logger logger)
{
a.setLogger(logger);
}
public void activateOptions()
{
a.activateOptions();
}
public void setBackupAppender(Appender appender)
{
a.setBackupAppender(appender);
}
public void setAppender(Appender appender)
{
a.setBackupAppender(appender);
}
ErrorHandler a;
ErrHandler(ErrorHandler errorhandler)
{
a = errorhandler;
}
}
public static class MyLoggerFactory
implements LoggerFactory
{
public Logger makeNewLoggerInstance(String s)
{
return new Log(s);
}
public MyLoggerFactory()
{
}
}
public Log(String s)
{
super(s);
f = "UNINITIALIZED LOGGING CONFIGURATION FILE NAME";
}
public static Log a(Class class1)
{
return a(class1.getName());
}
public static Log a(String s)
{
return (Log)Logger.getLogger(s, a);
Exception exception;
exception;
ErrorProcessing.b(exception, "Error occurred getting a logger instance.\n" + b.getString("Current_logging_configuration") + StaticContainer.e().ca);
return null;
}
public void a(ServletContext servletcontext)
{
String s = PSServlet.getConfigPath();
a(s, "PSLogging.properties");
}
public void a(String s, String s1)
{
BasicConfigurator.resetConfiguration();
c = false;
String s2 = null;
String s3 = null;
File file = null;
Properties properties = new Properties();
Object obj = null;
String s4 = null;
String s5 = null;
try
{
if(s == null)
throw new Exception("The PSNext servlet 'config' parameter is missing.");
if(s.length() <= 0)
throw new Exception("The PSNext servlet 'config' parameter is empty.");
File file1 = new File(s);
try
{
file1 = file1.getCanonicalFile();
}
catch(IOException ioexception)
{
throw new Exception("Could not get canonical form of PSNext domain config file: " + ioexception.getMessage());
}
if(file1 == null)
throw new Exception("Could not get canonical form of PSNext domain config file.");
file = file1.getParentFile();
if(file == null)
throw new Exception("Could not get directory of PSNext domain config file.");
File file2 = new File(file, s1);
Properties properties1;
try
{
s4 = file2.getAbsolutePath();
if(!file2.exists())
throw new Exception("PSNext logging configuration file " + file2.getAbsolutePath() + " does not exist.");
if(!file2.canRead())
throw new Exception("Access to PSNext logging configuration file " + file2.getAbsolutePath() + " is denied.");
FileInputStream fileinputstream = new FileInputStream(file2);
properties.load(fileinputstream);
properties1 = new Properties(properties);
fileinputstream.close();
}
catch(SecurityException securityexception)
{
throw new Exception("Access to PSNext logging configuration file " + file2.getAbsolutePath() + " is denied: " + securityexception.getMessage());
}
String s7 = PSServlet.getInstanceName() + "Log.properties";
File file3 = new File(file, s7);
try
{
s5 = file3.getAbsolutePath();
if(!file3.exists())
s3 = "PSNext Instance logging configuration file " + file3.getAbsolutePath() + " does not exist.";
else
if(!file3.canRead())
{
s3 = "Access to PSNext Instance logging configuration file " + file3.getAbsolutePath() + " is denied.";
} else
{
FileInputStream fileinputstream1 = new FileInputStream(file3);
properties1.load(fileinputstream1);
fileinputstream1.close();
}
}
catch(SecurityException securityexception1)
{
s3 = "Access to PSNext Instance logging configuration file " + file3.getAbsolutePath() + " is denied: " + securityexception1.getMessage();
}
PropertyConfigurator.configure(properties1);
if(c)
throw new Exception("Error occurred during first PSNext logging configuration attempt: " + s2);
Enumeration enumeration = Logger.getRoot().getAllAppenders();
if(!enumeration.hasMoreElements())
throw new Exception("No PSNext logging appenders were found.");
Appender appender;
for(; enumeration.hasMoreElements(); appender.setErrorHandler(new ErrHandler(appender.getErrorHandler())))
appender = (Appender)enumeration.nextElement();
forcedLog(getClass().getName(), Priority.INFO, b.getString("PSNext_servlet_logging_started_"), null);
if(c)
throw new Exception("Error occurred during first PSNext logging attempt: " + s2);
}
catch(Exception exception)
{
String s6 = " Standard logging configuration attempt failed.";
System.out.println(exception.getMessage() + s6);
BasicConfigurator.resetConfiguration();
Category.getRoot().setLevel(Level.WARN);
ConsoleAppender consoleappender = new ConsoleAppender(new TTCCLayout("ISO8601"));
Category.getRoot().addAppender(consoleappender);
File file4 = null;
FileOutputStream fileoutputstream = null;
try
{
if(file != null)
{
file4 = new File(file, "PSNext.log");
fileoutputstream = new FileOutputStream(file4);
}
}
catch(Exception exception1)
{
debug("Could not write log output file in PSNext configuration directory: " + exception1.getMessage());
}
if(fileoutputstream == null)
try
{
File file5;
for(file5 = new File(System.getProperty("user.dir")); file5.getParentFile() != null; file5 = file5.getParentFile());
file4 = new File(file5, "PSNext.log");
fileoutputstream = new FileOutputStream(file4);
}
catch(Exception exception2)
{
debug("Could not write log output file in current working directory's root directory: " + exception2.getMessage());
}
if(fileoutputstream == null)
try
{
file4 = File.createTempFile("PSNext", ".log");
fileoutputstream = new FileOutputStream(file4);
}
catch(Exception exception3)
{
debug("Could not write log output file in default temporary directory: " + exception3.getMessage());
}
if(fileoutputstream == null)
try
{
File file6 = new File(System.getProperty("user.dir"));
file4 = new File(file6, "PSNext.log");
fileoutputstream = new FileOutputStream(file4);
}
catch(Exception exception4)
{
debug("Could not write log output file in current working directory: " + exception4.getMessage());
}
if(fileoutputstream == null)
try
{
File file7 = new File(System.getProperty("user.home"));
file4 = new File(file7, "PSNext.log");
fileoutputstream = new FileOutputStream(file4);
}
catch(Exception exception5)
{
debug("Could not write log output file in app server account's home directory: " + exception5.getMessage());
}
if(fileoutputstream != null)
{
debug("Configuring file Writer appender.");
WriterAppender writerappender = new WriterAppender(new TTCCLayout("ISO8601"), fileoutputstream);
Category.getRoot().addAppender(writerappender);
} else
{
error("Unable to open a fallback log file.");
System.out.println("Unable to open a PSNext fallback log file.");
}
forcedLog(getClass().getName(), Priority.INFO, "Fallback logging for PSNext servlet started" + (fileoutputstream == null ? "." : " on " + file4.getAbsolutePath()), null);
}
if(s4 != null)
forcedLog(getClass().getName(), Priority.INFO, "Base logging configuration file: " + s4, null);
if(s5 != null)
forcedLog(getClass().getName(), Priority.INFO, "Instance-specific logging configuration file: " + s5, null);
if(s3 != null)
warn(s3);
}
public void a()
{
forcedLog(getClass().getName(), Priority.INFO, "PSNext Servlet Version: " + PSNextVersions.e.getName() + " / " + Util.l(), null);
}
public void b()
{
forcedLog(getClass().getName(), Priority.INFO, b.getString("PSNext_servlet_shutting_down_"), null);
LogManager.shutdown();
}
public void a(Properties properties, String s)
{
if(e)
{
String s1 = MessageFormat.format(b.getString("external_logging"), new Object[] {
s
});
forcedLog(getClass().getName(), Priority.INFO, s1, null);
} else
if(properties == null)
{
BasicConfigurator.configure();
Category.getRoot().setLevel(Level.OFF);
} else
{
BasicConfigurator.resetConfiguration();
PropertyConfigurator.configure(properties);
NDC.push(System.getProperty("user.name") + "/0");
forcedLog(getClass().getName(), Priority.INFO, b.getString("Logging_for_PSNext_client") + s, null);
f = s;
}
}
public void c()
{
StaticContainer.e().ca = f;
}
public void b(String s)
{
try
{
File file = new File(s);
PropertyConfigurator.configure(file.getAbsolutePath());
forcedLog(getClass().getName(), Priority.INFO, b.getString("Logging_for_PSNext_client") + s + ".", null);
}
catch(Exception exception)
{
String s1 = "Standard logging configuration attempt failed.";
System.out.println(exception.getMessage() + s1);
}
}
public void d()
{
forcedLog(getClass().getName(), Priority.INFO, b.getString("PSNext_client_logging_shutting"), null);
LogManager.shutdown();
}
public void c(String s)
{
forcedLog(getClass().getName(), Priority.INFO, s, null);
}
static boolean a(boolean flag)
{
return c = flag;
}
static String d(String s)
{
return d = s;
}
private static final MyLoggerFactory a = new MyLoggerFactory();
static ResourceBundle b = ExtResourceBundle.b("util.Log");
private static boolean c = false;
private static String d;
private static boolean e;
private String f;
static
{
e = false;
try
{
e = Category.getRoot().getAllAppenders().hasMoreElements();
if(!e)
{
BasicConfigurator.resetConfiguration();
Category.getRoot().setLevel(Level.WARN);
ConsoleAppender consoleappender = new ConsoleAppender(new TTCCLayout("ISO8601"));
Category.getRoot().addAppender(consoleappender);
}
}
catch(RuntimeException runtimeexception) { }
}
}
/*
DECOMPILATION REPORT
Decompiled from: C:\repository\Lib PSNext\last\PSClient.jar
Total time: 47 ms
Jad reported messages/errors:
Couldn't fully decompile method a
Couldn't resolve all exception handlers in method a
Exit status: 0
Caught exceptions:
*/ |
Partager