<artifactId>jewelcli</artifactId>
<version>0.8.3</version>
</dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.17</version>
+ </dependency>
</dependencies>
<properties>
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.net.SocketFactory;
import net.pterodactylus.irc.event.ChannelJoined;
import com.google.common.primitives.Longs;
import com.google.common.util.concurrent.AbstractExecutionThreadService;
import com.google.common.util.concurrent.Service;
+import org.apache.log4j.Logger;
/**
* A connection to an IRC server.
while (connected) {
Reply reply = connectionHandler.readReply();
eventBus.post(new ReplyReceived(this, reply));
- logger.finest(String.format("<< %s", reply));
+ logger.trace(String.format("<< %s", reply));
String command = reply.command();
List<String> parameters = reply.parameters();
char modeSymbol = parameter.charAt(closeParen + modeCharacterIndex);
nickPrefixes.put(String.valueOf(modeSymbol), String.valueOf(modeCharacter));
}
- logger.fine(String.format("Parsed Prefixes: %s", nickPrefixes));
+ logger.debug(String.format("Parsed Prefixes: %s", nickPrefixes));
}
} else if (parameter.startsWith("CHANTYPES=")) {
for (int typeIndex = 10; typeIndex < parameter.length(); ++typeIndex) {
channelTypes.add(parameter.charAt(typeIndex));
}
- logger.fine(String.format("Parsed Channel Types: %s", channelTypes));
+ logger.debug(String.format("Parsed Channel Types: %s", channelTypes));
}
}
}
eventBus.post(new ConnectionClosed(this));
} catch (IOException ioe1) {
- logger.log(Level.WARNING, "I/O error", ioe1);
+ logger.warn("I/O error", ioe1);
eventBus.post(new ConnectionClosed(this, ioe1));
} catch (RuntimeException re1) {
- logger.log(Level.SEVERE, "Runtime error", re1);
+ logger.error("Runtime error", re1);
eventBus.post(new ConnectionClosed(this, re1));
} finally {
established = false;
if (inetAddress.isPresent() && port.isPresent()) {
eventBus.post(new DccSendReceived(this, client, messageWords[2], inetAddress.get(), port.get(), fileSize));
} else {
- logger.warning(String.format("Received malformed DCC SEND: “%s”", message));
+ logger.warn(String.format("Received malformed DCC SEND: “%s”", message));
}
} else if (messageWords[1].equalsIgnoreCase("ACCEPT")) {
Optional<Integer> port = Optional.fromNullable(Ints.tryParse(messageWords[3]));
if (port.isPresent()) {
eventBus.post(new DccAcceptReceived(this, client, messageWords[2], port.get(), position));
} else {
- logger.warning(String.format("Received malformed DCC ACCEPT: “%s”", message));
+ logger.warn(String.format("Received malformed DCC ACCEPT: “%s”", message));
}
}
}
commandBuilder.append(parameter);
}
- logger.finest(String.format(">> %s", commandBuilder));
+ logger.trace(String.format(">> %s", commandBuilder));
outputStream.write((commandBuilder.toString() + "\r\n").getBytes("UTF-8"));
outputStream.flush();
}
import java.net.InetAddress;
import java.net.Socket;
import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import net.pterodactylus.irc.event.DccDownloadFailed;
import net.pterodactylus.irc.event.DccDownloadFinished;
import com.google.common.eventbus.EventBus;
import com.google.common.io.Closeables;
import com.google.common.util.concurrent.AbstractExecutionThreadService;
+import org.apache.log4j.Logger;
/**
* Service that receives a file offered by a {@link DccSendReceived}.
eventBus.post(new DccDownloadFailed(this, new IOException("Download aborted.")));
}
} catch (IOException ioe1) {
- logger.log(Level.WARNING, "I/O error while receiving DCC!", ioe1);
+ logger.warn("I/O error while receiving DCC!", ioe1);
eventBus.post(new DccDownloadFailed(this, ioe1));
} finally {
Closeables.close(inputStream, true);
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import net.pterodactylus.irc.Connection;
import net.pterodactylus.irc.ConnectionBuilder;
import com.google.common.io.Closeables;
import com.google.common.util.concurrent.AbstractExecutionThreadService;
import com.google.inject.Inject;
+import org.apache.log4j.Logger;
/**
* The core of XDCC Downloader.
try {
connection.sendMessage(bot.name(), "XDCC SEND " + pack.id());
} catch (IOException ioe1) {
- logger.log(Level.WARNING, "Could not send message to bot!", ioe1);
+ logger.warn("Could not send message to bot!", ioe1);
}
}
try {
connection.sendMessage(bot.name(), String.format("XDCC %s", (download.get().dccReceiver() != null) ? "CANCEL" : "REMOVE"));
} catch (IOException ioe1) {
- logger.log(Level.WARNING, String.format("Could not cancel DCC from %s (%s)!", bot.name(), bot.network().name()), ioe1);
+ logger.warn(String.format("Could not cancel DCC from %s (%s)!", bot.name(), bot.network().name()), ioe1);
}
}
eventBus.post(new GenericMessage(String.format("Trying to join %s on %s...", channel.name(), network.get().name())));
connectionEstablished.connection().joinChannel(channel.name());
} catch (IOException ioe1) {
- logger.log(Level.WARNING, String.format("Could not join %s on %s!", channel.name(), network.get().name()), ioe1);
+ logger.warn(String.format("Could not join %s on %s!", channel.name(), network.get().name()), ioe1);
}
}
}
/* add pack. */
bot.addPack(pack.get());
- logger.fine(String.format("Bot %s now has %d packs.", bot, bot.packs().size()));
+ logger.debug(String.format("Bot %s now has %d packs.", bot, bot.packs().size()));
}
/**
File outputFile = new File(temporaryDirectory, dccAcceptReceived.filename());
if (outputFile.length() != dccAcceptReceived.position()) {
eventBus.post(new GenericError(String.format("Download %s from %s does not start at the right position!")));
- logger.log(Level.WARNING, String.format("Download %s from %s: have %d bytes but wants to resume from %d!", dccAcceptReceived.filename(), dccAcceptReceived.source(), outputFile.length(), dccAcceptReceived.position()));
+ logger.warn(String.format("Download %s from %s: have %d bytes but wants to resume from %d!", dccAcceptReceived.filename(), dccAcceptReceived.source(), outputFile.length(), dccAcceptReceived.position()));
downloads.removeAll(download.pack().name());
return;
Collection<Download> requestedDownload = FluentIterable.from(downloads.get(dccDownloadFinished.dccReceiver().filename())).filter(FILTER_RUNNING).toSet();
if (requestedDownload.isEmpty()) {
/* this seems wrong. */
- logger.warning("Download finished but could not be located.");
+ logger.warn("Download finished but could not be located.");
return;
}
Download download = requestedDownload.iterator().next();
downloads.removeAll(download.pack().name());
} catch (IOException ioe1) {
/* TODO - handle all the errors. */
- logger.log(Level.WARNING, String.format("Could not move file %s to directory %s.", download.filename(), finalDirectory), ioe1);
+ logger.warn(String.format("Could not move file %s to directory %s.", download.filename(), finalDirectory), ioe1);
}
}
Collection<Download> requestedDownload = FluentIterable.from(downloads.get(dccDownloadFailed.dccReceiver().filename())).filter(FILTER_RUNNING).toSet();
if (requestedDownload.isEmpty()) {
/* this seems wrong. */
- logger.warning("Download finished but could not be located.");
+ logger.warn("Download finished but could not be located.");
return;
}
Download download = requestedDownload.iterator().next();
@Subscribe
public void replyReceived(ReplyReceived replyReceived) {
- logger.log(Level.FINEST, String.format("%s: %s", replyReceived.connection().hostname(), replyReceived.reply()));
+ logger.trace(String.format("%s: %s", replyReceived.connection().hostname(), replyReceived.reply()));
}
//