add logging
This commit is contained in:
parent
edfd04129e
commit
106087b685
|
@ -123,6 +123,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
|||
/// </summary>
|
||||
public void SaveConfiguration()
|
||||
{
|
||||
Logger.Info("Saving system configuration");
|
||||
var path = CommonApplicationPaths.SystemConfigurationFilePath;
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
|
|
@ -296,6 +296,8 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
|||
|
||||
private async Task<HttpResponseInfo> GetCachedResponse(string responseCachePath, TimeSpan cacheLength, string url)
|
||||
{
|
||||
_logger.Info("Checking for cache file {0}", responseCachePath);
|
||||
|
||||
try
|
||||
{
|
||||
if (_fileSystem.GetLastWriteTimeUtc(responseCachePath).Add(cacheLength) > DateTime.UtcNow)
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace MediaBrowser.Common.Implementations.Serialization
|
|||
|
||||
private Stream OpenFile(string path)
|
||||
{
|
||||
_logger.Debug("Deserializing file {0}", path);
|
||||
_logger.Info("Deserializing file {0}", path);
|
||||
return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 131072);
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ namespace MediaBrowser.Common.Implementations.Serialization
|
|||
/// <param name="file">The file.</param>
|
||||
public void SerializeToFile(object obj, string file)
|
||||
{
|
||||
_logger.Info("Serializing to file {0}", file);
|
||||
using (var stream = new FileStream(file, FileMode.Create))
|
||||
{
|
||||
SerializeToStream(obj, stream);
|
||||
|
@ -94,7 +95,7 @@ namespace MediaBrowser.Common.Implementations.Serialization
|
|||
/// <returns>System.Object.</returns>
|
||||
public object DeserializeFromFile(Type type, string file)
|
||||
{
|
||||
_logger.Debug("Deserializing file {0}", file);
|
||||
_logger.Info("Deserializing file {0}", file);
|
||||
using (var stream = _fileSystem.OpenRead(file))
|
||||
{
|
||||
return DeserializeFromStream(type, stream);
|
||||
|
|
|
@ -193,6 +193,7 @@ namespace MediaBrowser.Common.Implementations.Updates
|
|||
/// <returns>Task{List{PackageInfo}}.</returns>
|
||||
public async Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.Info("Opening {0}", PackageCachePath);
|
||||
try
|
||||
{
|
||||
using (var stream = _fileSystem.OpenRead(PackageCachePath))
|
||||
|
|
|
@ -12,6 +12,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using CommonIO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Localization
|
||||
{
|
||||
|
@ -35,6 +36,7 @@ namespace MediaBrowser.Server.Implementations.Localization
|
|||
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LocalizationManager" /> class.
|
||||
|
@ -42,11 +44,12 @@ namespace MediaBrowser.Server.Implementations.Localization
|
|||
/// <param name="configurationManager">The configuration manager.</param>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <param name="jsonSerializer">The json serializer.</param>
|
||||
public LocalizationManager(IServerConfigurationManager configurationManager, IFileSystem fileSystem, IJsonSerializer jsonSerializer)
|
||||
public LocalizationManager(IServerConfigurationManager configurationManager, IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger)
|
||||
{
|
||||
_configurationManager = configurationManager;
|
||||
_fileSystem = fileSystem;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_logger = logger;
|
||||
|
||||
ExtractAll();
|
||||
}
|
||||
|
@ -75,7 +78,10 @@ namespace MediaBrowser.Server.Implementations.Localization
|
|||
{
|
||||
using (var stream = type.Assembly.GetManifestResourceStream(resource))
|
||||
{
|
||||
using (var fs = _fileSystem.GetFileStream(Path.Combine(localizationPath, filename), FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||
var target = Path.Combine(localizationPath, filename);
|
||||
_logger.Info("Extracting ratings to {0}", target);
|
||||
|
||||
using (var fs = _fileSystem.GetFileStream(target, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||
{
|
||||
stream.CopyTo(fs);
|
||||
}
|
||||
|
|
|
@ -3862,7 +3862,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
? (CommandBehavior.SequentialAccess | CommandBehavior.SingleResult)
|
||||
: CommandBehavior.SequentialAccess;
|
||||
|
||||
Logger.Debug("GetItemValues: " + cmd.CommandText);
|
||||
//Logger.Debug("GetItemValues: " + cmd.CommandText);
|
||||
|
||||
using (var reader = cmd.ExecuteReader(commandBehavior))
|
||||
{
|
||||
|
|
|
@ -1929,34 +1929,5 @@ namespace MediaBrowser.Server.Mono.Security {
|
|||
password_max_length = value;
|
||||
}
|
||||
}
|
||||
|
||||
// static methods
|
||||
|
||||
static private byte[] LoadFile (string filename)
|
||||
{
|
||||
byte[] data = null;
|
||||
using (FileStream fs = File.OpenRead (filename)) {
|
||||
data = new byte [fs.Length];
|
||||
fs.Read (data, 0, data.Length);
|
||||
fs.Close ();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
static public PKCS12 LoadFromFile (string filename)
|
||||
{
|
||||
if (filename == null)
|
||||
throw new ArgumentNullException ("filename");
|
||||
|
||||
return new PKCS12 (LoadFile (filename));
|
||||
}
|
||||
|
||||
static public PKCS12 LoadFromFile (string filename, string password)
|
||||
{
|
||||
if (filename == null)
|
||||
throw new ArgumentNullException ("filename");
|
||||
|
||||
return new PKCS12 (LoadFile (filename), password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -418,7 +418,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||
|
||||
RegisterSingleInstance(ServerConfigurationManager);
|
||||
|
||||
LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer);
|
||||
LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer, LogManager.GetLogger("LocalizationManager"));
|
||||
RegisterSingleInstance(LocalizationManager);
|
||||
|
||||
RegisterSingleInstance<IBlurayExaminer>(() => new BdInfoExaminer());
|
||||
|
@ -489,7 +489,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||
var encryptionManager = new EncryptionManager();
|
||||
RegisterSingleInstance<IEncryptionManager>(encryptionManager);
|
||||
|
||||
ConnectManager = new ConnectManager(LogManager.GetLogger("Connect"), ApplicationPaths, JsonSerializer, encryptionManager, HttpClient, this, ServerConfigurationManager, UserManager, ProviderManager, SecurityManager, FileSystemManager);
|
||||
ConnectManager = new ConnectManager(LogManager.GetLogger("ConnectManager"), ApplicationPaths, JsonSerializer, encryptionManager, HttpClient, this, ServerConfigurationManager, UserManager, ProviderManager, SecurityManager, FileSystemManager);
|
||||
RegisterSingleInstance(ConnectManager);
|
||||
|
||||
DeviceManager = new DeviceManager(new DeviceRepository(ApplicationPaths, JsonSerializer, LogManager.GetLogger("DeviceManager"), FileSystemManager), UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LogManager.GetLogger("DeviceManager"), NetworkManager);
|
||||
|
|
Loading…
Reference in New Issue
Block a user