Foros del Web » Administración de Sistemas » Software para Servers »

Problema con el Apache Tomcat version 7.0.25

Estas en el tema de Problema con el Apache Tomcat version 7.0.25 en el foro de Software para Servers en Foros del Web. Hola una consulta, tengo un problema con mi aplicacion, la aplicacion corria mediante Tomcat 5.5, pero ahora que me pase a version 7.0.25, me genera ...
  #1 (permalink)  
Antiguo 15/02/2012, 00:56
Avatar de Sumerio  
Fecha de Ingreso: octubre-2009
Mensajes: 195
Antigüedad: 14 años, 6 meses
Puntos: 6
Pregunta Problema con el Apache Tomcat version 7.0.25

Hola una consulta, tengo un problema con mi aplicacion, la aplicacion corria mediante Tomcat 5.5, pero ahora que me pase a version 7.0.25, me genera errores como este, es un aplicacion web, que segun el modo de consola, me muestra este error, que no estoy seguro si la consiguracion es en el paquete del archivo inicial o en el Tomcat ya generado dentro de si mismo, segun me muestra este error:

****Error LoggerUtil(String propsFile, String className): java.io.FileNotFoundException: \usr\share\apache-tomcat-7.0.25\webapps\ExtSolutions\logs\defaultLog.log (El sistema no puede hallar la ruta especificada)
No se puede crear fichero log: \usr\share\apache-tomcat-7.0.25\webapps\ExtSolutions\logs


Donde LoggerUtil, es un Servlet creado con estas caracteristicas:

package util;

import java.io.*;
import java.util.Properties;

import javax.naming.InitialContext;

public class LoggerUtil{
private File logFile;
private String logFName;
private String logDName;
private File logDir;
private long logMaxSize;
private RandomAccessFile logRAF;
private int level = 0;

public final static int LOG_ERROR = 1;
public final static int LOG_INFO = 2;
public final static int LOG_DEBUG = 3;
public final static int LOG_IGNORE = 4;

public String className = "";

private synchronized void configure(String props, String className){
try{
InputStream is = new FileInputStream(props);
Properties fileProps = new Properties();
fileProps.load(is);
// Definicion de las propiedades del Log.
//Obtenemos las propiedades por defecto por si no hay propiedades para una clase en concreto

String defaultFName = fileProps.getProperty("defaultLogFileName");
String defaultDName = fileProps.getProperty("defaultLogDir");
String defaultMaxSize = fileProps.getProperty("defaultLogMaxLength");
String defaultLogLevel = fileProps.getProperty("defaultLogLevel");

this.logFName = fileProps.getProperty(className+".logFileName", defaultFName);
this.logDName = fileProps.getProperty(className+".logDir", defaultDName);
this.logMaxSize = Long.parseLong(fileProps.getProperty(className+".l ogMaxLength", defaultMaxSize));
String logLevel = fileProps.getProperty(className+".logLevel", defaultLogLevel);
if(logLevel.equals("ALL")){
this.level = 4;
}else if(logLevel.equals("DEBUG")){
this.level = 3;
}else if(logLevel.equals("INFO")){
this.level = 2;
}else if(logLevel.equals("ERROR")){
this.level = 1;
}else if(logLevel.equals("NONE")){
this.level = 0;
}
}catch(Exception e){
System.out.println("***Error al obtener las propiedades del fichero LOG (LoggerUtil.configure): "+e);
e.printStackTrace();
}
}

public LoggerUtil(String className) {
/*
String fileConfigLog=null;
try{
InitialContext ctx = new InitialContext();
fileConfigLog = (String) ctx.lookup("java:comp/env/config/logs");
}catch(Exception e){
System.out.println("initLog(): ****Error al incializar Contenido Log:"+e);
}
*/
try {
String fileConfigLog=null;
File f = new File(LoggerUtil.class.getResource("/").toURI());
String logs = f.getParentFile().getParentFile().getAbsolutePath( );
fileConfigLog=logs+"/logs/ConfigLogs.properties";

configure(fileConfigLog,className);
Calendario ahora = new Calendario();
this.logDir = new File(logDName);
this.className = className;
logFile = new File(logDir, logFName);

logRAF = new RandomAccessFile(logFile,"rw");
if (logRAF.length() == 0) {
logRAF.writeBytes(ahora.getFechaFormato("dd.MM.yy HH:mm:ss") + " " + "Log creado\r\n");
}
logRAF.close();
}catch (IOException e) {
System.out.println("****Error LoggerUtil(String propsFile, String className): "+e);
System.out.println("No se puede crear fichero log: " + logDir);
//throw new IOException("No se puede crear fichero log: " + logDir);
}catch (Exception e){
System.out.println("****Error LoggerUtil(String propsFile, String className): "+e);
}
}


public synchronized void write(String msg,int logLevel) throws IOException {
try {
if(this.level >= logLevel){
logRAF = new RandomAccessFile(logFile, "rw");
if (logRAF.length() >= logMaxSize) {
logRAF.close();
this.rotate();
logRAF = new RandomAccessFile(logFile, "rw");
}
logRAF.seek(logRAF.length());
Calendario ahora = new Calendario();
msg = ahora.getFechaFormato("dd.MM.yy HH:mm:ss") + " " + msg;
logRAF.writeBytes(msg + "\r\n");
logRAF.close();
}
}catch (IOException e) {
System.out.println("****Error write(String msg,int logLevel): "+e);
System.out.println("****Error write(String msg,int logLevel) TRAZA: "+msg);
throw new IOException("Log Error");
}catch (Exception e){
System.out.println("****Error write(String msg,int logLevel): "+e);
System.out.println("****Error write(String msg,int logLevel) TRAZA: "+msg);
}
}

public synchronized void write(Exception e) throws IOException {
try {
logRAF = new RandomAccessFile(logFile, "rw");
if (logRAF.length() >= logMaxSize) {
logRAF.close();
this.rotate();
logRAF = new RandomAccessFile(logFile, "rw");
}
logRAF.seek(logRAF.length());
Calendario ahora = new Calendario();
String msg = ahora.getFechaFormato("dd.MM.yy HH.mm:ss") + " " + e.getMessage();
logRAF.writeBytes(msg + "\r\n");
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
PrintWriter p = new PrintWriter(bytes, true);
e.printStackTrace(p);
logRAF.writeBytes(bytes.toString());
FileOutputStream fout = new FileOutputStream( "error" );
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fout));
logRAF.close();
}catch (IOException ioe) {
System.out.println("****Error write(Exception e): "+ioe);
System.out.println("****Error write(Exception e) TRAZA: "+e);
throw new IOException("Log Error");
}catch (Exception ex){
System.out.println("****Error write(Exception e): "+ex);
System.out.println("****Error write(Exception e) TRAZA: "+e);
}
}

public synchronized void rotate() throws IOException {
try {
Calendario ahora = new Calendario();
String hoy = "";
// Generamos el formato AAAAMMDDHHMMSS
hoy = ahora.getFechaFormato("yyyyMMddHHmmss");
// Formateamos el nuevo nombre del log
File oldLogFile = new File(logDir, logFName + "." + hoy + ".rot");
// delete older log file
if (oldLogFile.exists()) {oldLogFile.delete();}
// rename the actual one to "*.log_old"
logFile.renameTo(oldLogFile);
// create a new one
logRAF = new RandomAccessFile(logFile, "rw");
logRAF.writeBytes(ahora.getFechaFormato("dd.MM.yy HH:mm:ss") + " " + "Log creado\r\n");
logRAF.close();
}catch (IOException e) {
System.out.println("****Error rotate(): "+e);
throw new IOException("Log Error");
}catch (Exception ex){
System.out.println("****Error rotate(): "+ex);
}
}

/**
* Método que genera una traza de informaciín en el log.
* @param msg Texto a imprimir.
*/
public void infoLog(String msg){
try {
write("INFO: "+className+"."+msg,LoggerUtil.LOG_INFO);
} catch (IOException e){
System.out.println("Error al escribir el log "+className+e+" MSG: "+msg);

}
}

/**
* Método que genera una traza de error en el log.
* @param msg Texto a imprimir.
*/
public void errorLog(String msg){
try {
write("ERROR: "+className+"."+msg,LoggerUtil.LOG_ERROR);
} catch (IOException e){
System.out.println("Error al escribir el log "+className+" MSG: "+msg);

}

}
/**
* Método que genera una traza de debug en el log.
* @param msg Texto a imprimir.
*/
public void debugLog(String msg){
try {
write("DEBUG: "+this.className+"."+msg,LoggerUtil.LOG_DEBUG) ;
} catch (IOException e){
System.out.println("Error al escribir el log "+className+e+" MSG: "+msg);

}
}


} //END EventLog


Alguien me puede ayudar con este problema, si no haya la ruta especifica no va funcionar mi sistema

Etiquetas: apache, red, tomcat
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:37.