You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by co...@apache.org on 2002/02/21 12:34:07 UTC
cvs commit: jakarta-avalon-logkit/src/java/org/apache/log/output/io/rotate RotateStrategyByDate.java
colus 02/02/21 03:34:07
Added: src/java/org/apache/log/output/io/rotate
RotateStrategyByDate.java
Log:
Added date format rotate stratgey for log file per day.
Renamed to RotateStrategyByDate.
Revision Changes Path
1.1 jakarta-avalon-logkit/src/java/org/apache/log/output/io/rotate/RotateStrategyByDate.java
Index: RotateStrategyByDate.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.log.output.io.rotate;
import java.io.File;
import java.util.Date;
import java.text.SimpleDateFormat;
/**
* Rotation stragety based on SimpleDateFormat.
*
* @author <a href="mailto:colus@apache.org">Eung-ju Park</a>
* @version $Revision: 1.1 $ $Date: 2002/02/21 11:34:07 $
*/
public class RotateStrategyByDate
implements RotateStrategy
{
private SimpleDateFormat m_format;
private Date m_date;
private String m_current;
public RotateStrategyByDate( final String pattern )
{
m_format = new SimpleDateFormat( pattern );
m_date = new Date();
m_current = m_format.format( m_date );
}
public void reset()
{
m_current = m_format.format( m_date );
}
public boolean isRotationNeeded( final String data, final File file )
{
m_date.setTime( System.currentTimeMillis() );
if ( m_current.equals( m_format.format( m_date ) ) )
{
return true;
}
return false;
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>