Commit 1cfd70ab by Yonathan Carvajal

cambio en la forma de crear los logs

parent 314103e2
export ENV=development
export HOST_TRUSTED=url_trustedx
export PUERTO=38080 o 38081
...@@ -7,21 +7,18 @@ import org.springframework.http.HttpStatus; ...@@ -7,21 +7,18 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.apache.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import co.com.certicamara.dto.EntidadSolicitudDto; import co.com.certicamara.dto.EntidadSolicitudDto;
import co.com.certicamara.utils.UtilsXML; import co.com.certicamara.utils.UtilsXML;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;
@Service @Service
public class SoapClienteServicio { public class SoapClienteServicio {
private final Logger logger = Logger.getLogger(this.getClass()); private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Value("${HOST_TRUSTED}") @Value("${HOST_TRUSTED}")
private String host; private String host;
......
package co.com.certicamara.servicio; package co.com.certicamara.servicio;
import org.apache.log4j.Logger; import org.apache.tomcat.util.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -17,7 +19,6 @@ import javax.xml.bind.JAXBContext; ...@@ -17,7 +19,6 @@ import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller; import javax.xml.bind.Unmarshaller;
import java.io.*; import java.io.*;
import org.apache.commons.codec.binary.Base64;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.math.BigInteger; import java.math.BigInteger;
import java.security.Principal; import java.security.Principal;
...@@ -33,7 +34,7 @@ import java.util.Map; ...@@ -33,7 +34,7 @@ import java.util.Map;
@Service @Service
public class TrustedServicio { public class TrustedServicio {
private final Logger logger = Logger.getLogger(this.getClass()); private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired @Autowired
private SoapClienteServicio soapClienteServicio; private SoapClienteServicio soapClienteServicio;
......
package co.com.certicamara.utils; package co.com.certicamara.utils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
...@@ -14,11 +14,13 @@ import javax.xml.transform.TransformerFactory; ...@@ -14,11 +14,13 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import java.io.StringWriter; import java.io.StringWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Component @Component
public class UtilsXML { public class UtilsXML {
private final Logger logger = Logger.getLogger(this.getClass()); private final Logger logger = LoggerFactory.getLogger(this.getClass());
public String generarSoapCertificados(String username, String password, String nuip) public String generarSoapCertificados(String username, String password, String nuip)
throws ParserConfigurationException { throws ParserConfigurationException {
......
# Root logger option
log4j.rootLogger=INFO, stdout, file
# Redirect log messages to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
# Redirect log messages to a log file, support file rolling.
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.DatePattern='.'yyyy-MM-dd
log4j.appender.file.File=../logs/ms_list_certificate.log
>>>>>>> logs
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>../logs/Ms-list-certificate.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>../logs/Ms-list-certificate-%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>10MB</maxFileSize> <!-- Tamaño máximo del archivo antes de rotar -->
<!-- <maxHistory>10</maxHistory> Número máximo de archivos de registro a mantener -->
<!-- <totalSizeCap>1GB</totalSizeCap> Tamaño total máximo de todos los archivos de registro -->
</rollingPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="console"/>
<appender-ref ref="file"/>
</root>
</configuration>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment