Yes, milliseconds would be fine too. 

Sent from my iPhone

> On 2015/07/19, at 9:44, Gary Gregory <[email protected]> wrote:
> 
> Do you think I should revert of do this instead:
> 
>             final long durationMillis = 
> TimeUnit.NANOSECONDS.toMilliseconds(System.nanoTime() - startNanos);
>             LOGGER.trace("DefaultRolloverStrategy.purge() took {} 
> milliseconds", durationMillis );
> 
> Gary
> 
>> On Sat, Jul 18, 2015 at 10:07 AM, Remko Popma <[email protected]> wrote:
>> This is not actually the same since the previous code used to display the 
>> duration as a double: "...purge took 0.56 seconds". The new code rounds down 
>> to the nearest integer.
>> 
>> Sent from my iPhone
>> 
>> > On 2015/07/09, at 10:20, [email protected] wrote:
>> >
>> > Repository: logging-log4j2
>> > Updated Branches:
>> >  refs/heads/master b6f7897c1 -> b1d61b04a
>> >
>> >
>> > Use TimeUnit instead of custom computation.
>> >
>> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>> > Commit: 
>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/b1d61b04
>> > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/b1d61b04
>> > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/b1d61b04
>> >
>> > Branch: refs/heads/master
>> > Commit: b1d61b04a4f1a41a36dcd87b772acc8dfec4f580
>> > Parents: b6f7897
>> > Author: ggregory <[email protected]>
>> > Authored: Wed Jul 8 17:19:58 2015 -0700
>> > Committer: ggregory <[email protected]>
>> > Committed: Wed Jul 8 17:19:58 2015 -0700
>> >
>> > ----------------------------------------------------------------------
>> > .../log4j/core/appender/rolling/DefaultRolloverStrategy.java  | 7 ++++---
>> > 1 file changed, 4 insertions(+), 3 deletions(-)
>> > ----------------------------------------------------------------------
>> >
>> >
>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b1d61b04/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
>> > ----------------------------------------------------------------------
>> > diff --git 
>> > a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
>> >  
>> > b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
>> > index da3a778..7675326 100644
>> > --- 
>> > a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
>> > +++ 
>> > b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
>> > @@ -20,6 +20,7 @@ import java.io.File;
>> > import java.util.ArrayList;
>> > import java.util.List;
>> > import java.util.Objects;
>> > +import java.util.concurrent.TimeUnit;
>> > import java.util.zip.Deflater;
>> >
>> > import org.apache.logging.log4j.Logger;
>> > @@ -469,14 +470,14 @@ public class DefaultRolloverStrategy implements 
>> > RolloverStrategy {
>> >         if (maxIndex < 0) {
>> >             return null;
>> >         }
>> > -        final long start = System.nanoTime();
>> > +        final long startNanos = System.nanoTime();
>> >         final int fileIndex = purge(minIndex, maxIndex, manager);
>> >         if (fileIndex < 0) {
>> >             return null;
>> >         }
>> >         if (LOGGER.isTraceEnabled()) {
>> > -            final double duration = (System.nanoTime() - start) / (1000.0 
>> > * 1000.0 * 1000.0);
>> > -            LOGGER.trace("DefaultRolloverStrategy.purge() took {} 
>> > seconds", duration);
>> > +            final double durationSeconds = 
>> > TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - startNanos);
>> > +            LOGGER.trace("DefaultRolloverStrategy.purge() took {} 
>> > seconds", durationSeconds);
>> >         }
>> >         final StringBuilder buf = new StringBuilder(255);
>> >         manager.getPatternProcessor().formatFileName(subst, buf, 
>> > fileIndex);
>> >
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
> 
> 
> 
> -- 
> E-Mail: [email protected] | [email protected] 
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

Reply via email to