From ec96b9711debdd6c52f7dbb21556ff0004eea73f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20Thomas?= Date: Sun, 10 Mar 2019 21:40:41 +0100 Subject: [PATCH] Show more informative messages while streaming When streaming, log messages now show the URL and IP of the originating request, so that it's easier to determine what client is listening to something on the server. --- .../java/org/airsonic/player/controller/StreamController.java | 4 ++-- .../java/org/airsonic/player/io/PlayQueueInputStream.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/StreamController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/StreamController.java index fc97b95c..f804dd78 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/StreamController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/StreamController.java @@ -108,7 +108,7 @@ public class StreamController { playQueue.addFiles(false, playlistService.getFilesInPlaylist(playlistId)); player.setPlayQueue(playQueue); Util.setContentLength(response, playQueue.length()); - LOG.info("Incoming Podcast request for playlist " + playlistId); + LOG.info("{}: Incoming Podcast request for playlist {}", request.getRemoteAddr(), playlistId); } response.setHeader("Access-Control-Allow-Origin", "*"); @@ -165,7 +165,7 @@ public class StreamController { range = getRange(request, file); if (settingsService.isEnableSeek() && range != null && !file.isVideo()) { - LOG.info("Got HTTP range: " + range); + LOG.info("{}: Got HTTP range: {}", request.getRemoteAddr(), range); response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT); Util.setContentLength(response, range.isClosed() ? range.size() : fileLength - range.getFirstBytePos()); long lastBytePos = range.getLastBytePos() != null ? range.getLastBytePos() : fileLength - 1; diff --git a/airsonic-main/src/main/java/org/airsonic/player/io/PlayQueueInputStream.java b/airsonic-main/src/main/java/org/airsonic/player/io/PlayQueueInputStream.java index b48f1e14..af799c62 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/io/PlayQueueInputStream.java +++ b/airsonic-main/src/main/java/org/airsonic/player/io/PlayQueueInputStream.java @@ -117,7 +117,7 @@ public class PlayQueueInputStream extends InputStream { close(); } else if (!file.equals(currentFile)) { close(); - LOG.info(player.getUsername() + " listening to \"" + FileUtil.getShortPath(file.getFile()) + "\""); + LOG.info("{}: {} listening to {}", player.getIpAddress(), player.getUsername(), FileUtil.getShortPath(file.getFile())); mediaFileService.incrementPlayCount(file); // Don't scrobble REST players (except Sonos)