Skip to content

Commit

Permalink
refactor: removed commons logging dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Ruaux committed Aug 15, 2022
1 parent 75d986e commit a0dc0b3
Showing 1 changed file with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,21 @@

package com.redis.riot.file.resource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.item.*;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Writer;
import java.nio.channels.Channels;
import java.nio.channels.WritableByteChannel;
import java.nio.charset.UnsupportedCharsetException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.ItemStreamException;
import org.springframework.batch.item.WriteFailedException;
import org.springframework.batch.item.WriterNotOpenException;
import org.springframework.batch.item.file.FlatFileFooterCallback;
import org.springframework.batch.item.file.FlatFileHeaderCallback;
import org.springframework.batch.item.file.ResourceAwareItemWriterItemStream;
Expand All @@ -28,14 +40,6 @@
import org.springframework.core.io.WritableResource;
import org.springframework.util.Assert;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Writer;
import java.nio.channels.Channels;
import java.nio.channels.WritableByteChannel;
import java.nio.charset.UnsupportedCharsetException;
import java.util.List;

/**
* Base class for item writers that write data to a file or stream. This class
* provides common features like restart, force sync, append etc. The location
Expand All @@ -60,7 +64,7 @@ public abstract class AbstractResourceItemWriter<T> extends AbstractItemStreamIt

public static final boolean DEFAULT_TRANSACTIONAL = true;

protected static final Log logger = LogFactory.getLog(AbstractResourceItemWriter.class);
protected static final Logger logger = Logger.getLogger(AbstractResourceItemWriter.class.getName());

public static final String DEFAULT_LINE_SEPARATOR = System.getProperty("line.separator");

Expand Down Expand Up @@ -218,8 +222,8 @@ public void write(List<? extends T> items) throws Exception {
throw new WriterNotOpenException("Writer must be open before it can be written to");
}

if (logger.isDebugEnabled()) {
logger.debug("Writing to file with " + items.size() + " items.");
if (logger.isLoggable(Level.FINE)) {
logger.fine("Writing to file with " + items.size() + " items.");
}

OutputState state = getOutputState();
Expand Down

0 comments on commit a0dc0b3

Please sign in to comment.