浏览代码

update logging levels

Luke Pulverenti 9 年之前
父节点
当前提交
4ad96e4ff5

+ 2 - 2
Emby.Drawing/ImageProcessor.cs

@@ -774,11 +774,11 @@ namespace Emby.Drawing
 
             try
             {
-                _logger.Debug("Creating image collage and saving to {0}", options.OutputPath);
+                _logger.Info("Creating image collage and saving to {0}", options.OutputPath);
 
                 _imageEncoder.CreateImageCollage(options);
 
-                _logger.Debug("Completed creation of image collage and saved to {0}", options.OutputPath);
+                _logger.Info("Completed creation of image collage and saved to {0}", options.OutputPath);
             }
             finally
             {

+ 4 - 4
MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs

@@ -626,7 +626,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
                 {
                     try
                     {
-                        Logger.Debug(Name + ": Cancelling");
+                        Logger.Info(Name + ": Cancelling");
                         token.Cancel();
                     }
                     catch (Exception ex)
@@ -639,16 +639,16 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
                 {
                     try
                     {
-                        Logger.Debug(Name + ": Waiting on Task");
+                        Logger.Info(Name + ": Waiting on Task");
                         var exited = Task.WaitAll(new[] { task }, 2000);
 
                         if (exited)
                         {
-                            Logger.Debug(Name + ": Task exited");
+                            Logger.Info(Name + ": Task exited");
                         }
                         else
                         {
-                            Logger.Debug(Name + ": Timed out waiting for task to stop");
+                            Logger.Info(Name + ": Timed out waiting for task to stop");
                         }
                     }
                     catch (Exception ex)

+ 24 - 11
MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs

@@ -149,7 +149,11 @@ namespace MediaBrowser.MediaEncoding.Probing
 
                 if (!string.IsNullOrEmpty(streamInfo.sample_rate))
                 {
-                    stream.SampleRate = int.Parse(streamInfo.sample_rate, _usCulture);
+                    int value;
+                    if (int.TryParse(streamInfo.sample_rate, NumberStyles.Any, _usCulture, out value))
+                    {
+                        stream.SampleRate = value;
+                    }
                 }
 
                 stream.ChannelLayout = ParseChannelLayout(streamInfo.channel_layout);
@@ -190,12 +194,21 @@ namespace MediaBrowser.MediaEncoding.Probing
 
             if (!string.IsNullOrEmpty(streamInfo.bit_rate))
             {
-                bitrate = int.Parse(streamInfo.bit_rate, _usCulture);
+                int value;
+                if (int.TryParse(streamInfo.bit_rate, NumberStyles.Any, _usCulture, out value))
+                {
+                    bitrate = value;
+                }
             }
-            else if (formatInfo != null && !string.IsNullOrEmpty(formatInfo.bit_rate) && stream.Type == MediaStreamType.Video)
+
+            if (bitrate == 0 && formatInfo != null && !string.IsNullOrEmpty(formatInfo.bit_rate) && stream.Type == MediaStreamType.Video)
             {
                 // If the stream info doesn't have a bitrate get the value from the media format info
-                bitrate = int.Parse(formatInfo.bit_rate, _usCulture);
+                int value;
+                if (int.TryParse(formatInfo.bit_rate, NumberStyles.Any, _usCulture, out value))
+                {
+                    bitrate = value;
+                }
             }
 
             if (bitrate > 0)
@@ -518,23 +531,23 @@ namespace MediaBrowser.MediaEncoding.Probing
 
             // These support mulitple values, but for now we only store the first.
             var mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Artist Id"));
-            if(mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ALBUMARTISTID"));
+            if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ALBUMARTISTID"));
             audio.SetProviderId(MetadataProviders.MusicBrainzAlbumArtist, mb);
-            
+
             mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Artist Id"));
-            if(mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ARTISTID"));
+            if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ARTISTID"));
             audio.SetProviderId(MetadataProviders.MusicBrainzArtist, mb);
 
             mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Id"));
-            if(mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ALBUMID"));
+            if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_ALBUMID"));
             audio.SetProviderId(MetadataProviders.MusicBrainzAlbum, mb);
-            
+
             mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Release Group Id"));
-            if(mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_RELEASEGROUPID"));
+            if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_RELEASEGROUPID"));
             audio.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, mb);
 
             mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Release Track Id"));
-            if(mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_RELEASETRACKID"));
+            if (mb == null) mb = GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MUSICBRAINZ_RELEASETRACKID"));
             audio.SetProviderId(MetadataProviders.MusicBrainzTrack, mb);
         }
 

+ 1 - 1
MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs

@@ -411,7 +411,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
                 }
             };
 
-            _logger.Debug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
+            _logger.Info("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
 
             var logFilePath = Path.Combine(_appPaths.LogDirectoryPath, "ffmpeg-sub-convert-" + Guid.NewGuid() + ".txt");
 			_fileSystem.CreateDirectory(Path.GetDirectoryName(logFilePath));

+ 1 - 1
MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs

@@ -734,7 +734,7 @@ namespace MediaBrowser.Providers.MediaInfo
                     return minSizeVobs.Count == 0 ? vobs.Select(i => i.FullName) : minSizeVobs.Select(i => i.FullName);
                 }
 
-                _logger.Debug("Could not determine vob file list for {0} using DvdLib. Will scan using file sizes.", video.Path);
+                _logger.Info("Could not determine vob file list for {0} using DvdLib. Will scan using file sizes.", video.Path);
             }
 
             var files = allVobs

+ 1 - 1
MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs

@@ -81,7 +81,7 @@ namespace MediaBrowser.Providers.MediaInfo
             // Can't extract if we didn't find a video stream in the file
             if (!video.DefaultVideoStreamIndex.HasValue)
             {
-                _logger.Debug("Skipping image extraction due to missing DefaultVideoStreamIndex for {0}.", video.Path ?? string.Empty);
+                _logger.Info("Skipping image extraction due to missing DefaultVideoStreamIndex for {0}.", video.Path ?? string.Empty);
                 return Task.FromResult(new DynamicImageResponse { HasImage = false });
             }
 

+ 1 - 1
MediaBrowser.Server.Implementations/Channels/ChannelPostScanTask.cs

@@ -143,7 +143,7 @@ namespace MediaBrowser.Server.Implementations.Channels
 
         private async Task CleanChannel(Guid id, CancellationToken cancellationToken)
         {
-            _logger.Debug("Cleaning channel {0} from database", id);
+            _logger.Info("Cleaning channel {0} from database", id);
 
             // Delete all channel items
             var allIds = _libraryManager.GetItemIds(new InternalItemsQuery

+ 1 - 1
MediaBrowser.Server.Implementations/HttpServer/LoggerUtils.cs

@@ -27,7 +27,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
 
             var msg = "HTTP Response " + statusCode + " to " + endPoint + responseTime;
 
-            logger.LogMultiline(msg, LogSeverity.Debug, log);
+            logger.LogMultiline(msg, LogSeverity.Info, log);
         }
     }
 }

+ 1 - 1
MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs

@@ -220,7 +220,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
         {
             if (string.IsNullOrWhiteSpace(token))
             {
-                throw new SecurityException("Access token is invalid or expired.");
+                throw new SecurityException("Access token is required.");
             }
 
             var info = GetTokenInfo(request);

+ 5 - 1
MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs

@@ -62,8 +62,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
                 auth.TryGetValue("Version", out version);
             }
 
-            var token = httpReq.Headers["X-MediaBrowser-Token"];
+            var token = httpReq.Headers["X-Emby-Token"];
 
+            if (string.IsNullOrWhiteSpace(token))
+            {
+                token = httpReq.Headers["X-MediaBrowser-Token"];
+            }
             if (string.IsNullOrWhiteSpace(token))
             {
                 token = httpReq.QueryString["api_key"];

+ 1 - 1
MediaBrowser.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs

@@ -191,7 +191,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
 
             var type = request.IsWebSocketRequest ? "Web Socket" : "HTTP " + request.HttpMethod;
 
-            logger.LogMultiline(type + " " + request.Url, LogSeverity.Debug, log);
+            logger.LogMultiline(type + " " + request.Url, LogSeverity.Info, log);
         }
 
         private void HandleError(Exception ex, HttpListenerContext context)

+ 4 - 2
MediaBrowser.Server.Implementations/Session/SessionManager.cs

@@ -1324,7 +1324,7 @@ namespace MediaBrowser.Server.Implementations.Session
             if (existing.Items.Length > 0)
             {
                 var token = existing.Items[0].AccessToken;
-                _logger.Debug("Reissuing access token: " + token);
+                _logger.Info("Reissuing access token: " + token);
                 return token;
             }
 
@@ -1340,7 +1340,7 @@ namespace MediaBrowser.Server.Implementations.Session
                 AccessToken = Guid.NewGuid().ToString("N")
             };
 
-            _logger.Debug("Creating new access token for user {0}", userId);
+            _logger.Info("Creating new access token for user {0}", userId);
             await _authRepo.Create(newToken, CancellationToken.None).ConfigureAwait(false);
 
             return newToken.AccessToken;
@@ -1353,6 +1353,8 @@ namespace MediaBrowser.Server.Implementations.Session
                 throw new ArgumentNullException("accessToken");
             }
 
+            _logger.Info("Logging out access token {0}", accessToken);
+
             var existing = _authRepo.Get(new AuthenticationInfoQuery
             {
                 Limit = 1,

+ 2 - 2
MediaBrowser.Server.Startup.Common/ApplicationHost.cs

@@ -502,7 +502,7 @@ namespace MediaBrowser.Server.Startup.Common
             LiveTvManager = new LiveTvManager(this, ServerConfigurationManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager);
             RegisterSingleInstance(LiveTvManager);
 
-            UserViewManager = new UserViewManager(LibraryManager, LocalizationManager, UserManager, ChannelManager, LiveTvManager, PlaylistManager, CollectionManager, ServerConfigurationManager);
+            UserViewManager = new UserViewManager(LibraryManager, LocalizationManager, UserManager, ChannelManager, LiveTvManager, ServerConfigurationManager);
             RegisterSingleInstance(UserViewManager);
 
             var contentDirectory = new ContentDirectory(dlnaManager, UserDataManager, ImageProcessor, LibraryManager, ServerConfigurationManager, UserManager, LogManager.GetLogger("UpnpContentDirectory"), HttpClient, LocalizationManager, ChannelManager, MediaSourceManager);
@@ -944,7 +944,7 @@ namespace MediaBrowser.Server.Startup.Common
                 Logger.ErrorException("Error sending server restart notification", ex);
             }
 
-            Logger.Debug("Calling NativeApp.Restart");
+            Logger.Info("Calling NativeApp.Restart");
 
             NativeApp.Restart(_startupOptions);
         }