forked from Coded/SIPRP
git-svn-id: https://svn.coded.pt/svn/SIPRP@1699 bb69d46d-e84e-40c8-a05a-06db0d633741
parent
c015997362
commit
b1a48fc639
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,54 @@
|
|||||||
|
package com.evolute.siprp.pagina;
|
||||||
|
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.servlet.ServletContextEvent;
|
||||||
|
import javax.servlet.ServletContextListener;
|
||||||
|
|
||||||
|
import com.evolute.utils.date.DateUtils;
|
||||||
|
import com.evolute.utils.error.ErrorLogger;
|
||||||
|
|
||||||
|
|
||||||
|
public class SiprpWebContextListener implements ServletContextListener
|
||||||
|
{
|
||||||
|
|
||||||
|
private long startedTime = 0L;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void contextInitialized( ServletContextEvent event )
|
||||||
|
{
|
||||||
|
startedTime = System.currentTimeMillis();
|
||||||
|
System.out.println( "\n\nsiprpWeb . contextInitialized() : " + startedTime );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.out.println( "\nInitializing siprpWeb logger ...\n\n" );
|
||||||
|
SiprpWebLoggerInitializer.init();
|
||||||
|
}
|
||||||
|
catch ( Exception e )
|
||||||
|
{
|
||||||
|
e.printStackTrace( System.err );
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorLogger.logException( new Exception( "siprpWeb context initialized." ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void contextDestroyed( ServletContextEvent event )
|
||||||
|
{
|
||||||
|
System.out.println( "\n\nsiprpWeb . contextDestroyed() : " );
|
||||||
|
|
||||||
|
long endTime = System.currentTimeMillis();
|
||||||
|
SimpleDateFormat D_F = new SimpleDateFormat( "dd-MM-yyyy HH:mm:ss" );
|
||||||
|
Date startDate = new Date( startedTime );
|
||||||
|
Date endDate = new Date( endTime );
|
||||||
|
String timePassed = DateUtils.getTimePassed( startedTime, endTime );
|
||||||
|
System.out.println( "\trunning for: " + D_F.format( startDate ) + " -> " + D_F.format( endDate ) + " = " + ( (endTime - startedTime) / 1000 ) + " s ; " + timePassed );
|
||||||
|
|
||||||
|
ErrorLogger.logException( new Exception( "siprpWeb context destroyed. running for: " + D_F.format( startDate ) + " -> " + D_F.format( endDate ) + " = " + ( (endTime - startedTime) / 1000 ) + " s ; " + timePassed ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
package com.evolute.siprp.pagina;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import com.evolute.utils.error.ErrorLogger;
|
||||||
|
import com.evolute.utils.error.Logger;
|
||||||
|
import com.evolute.utils.error.LoggerProperties;
|
||||||
|
import com.evolute.utils.error.ProjectsEnum;
|
||||||
|
import com.evolute.utils.error.ws.WSLogger;
|
||||||
|
import com.evolute.utils.network.proxy.EvoProxyObject;
|
||||||
|
|
||||||
|
public class SiprpWebLoggerInitializer
|
||||||
|
{
|
||||||
|
|
||||||
|
public static void init() throws Exception
|
||||||
|
{
|
||||||
|
HashMap< LoggerProperties, String > properties = new HashMap< LoggerProperties, String >();
|
||||||
|
properties.put( LoggerProperties.SOFTWARE_NAME, "SIPRP - siprpWeb" );
|
||||||
|
properties.put( LoggerProperties.SOFTWARE_VERSION, "1" );
|
||||||
|
properties.put( LoggerProperties.PROJECT, ProjectsEnum.SIPRP.toString() );
|
||||||
|
properties.put( LoggerProperties.PROJECT_NAME, ProjectsEnum.SIPRP.toString() );
|
||||||
|
properties.put( LoggerProperties.PROJECT_VERSION, "1" );
|
||||||
|
|
||||||
|
String user = "";
|
||||||
|
String pass = "";
|
||||||
|
String host = "";
|
||||||
|
String port = "";
|
||||||
|
|
||||||
|
EvoProxyObject.configSystemProxySelector();
|
||||||
|
EvoProxyObject.getProxy( user, pass, host, port );
|
||||||
|
|
||||||
|
Logger logger = new WSLogger( properties );
|
||||||
|
ErrorLogger.initializeLogger( logger );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in new issue