Redth / PushSharp

A server-side library for sending Push Notifications to iOS (iPhone/iPad APNS), Android (C2DM and GCM - Google Cloud Message), Windows Phone, Windows 8, Amazon, Blackberry, and (soon) FirefoxOS devices!
Other
4.38k stars 1.52k forks source link

Disable Logging in Console #908

Open reeceengle opened 5 years ago

reeceengle commented 5 years ago

What version of PushSharp are you using?

4.0.10

Describe your issue:

Is there a way to disable PushSharp's console logging?

Just upgraded from PushSharp 2->4.0.10 and we are seeing a lot of logging in the console. At load, this is causing a lot of new slowness that is degrading the performance of some high-traffic tasks.

What are the steps required to reproduce this issue?

Using the ApnsPushBroker and queueing notifications.

Please provide any Exception Stack Traces

2019-09-10 21:37:47.PM [INFO] Stopping: Waiting on Tasks 2019-09-10 21:37:47.PM [INFO] Waiting on all tasks 1 2019-09-10 21:37:48.PM [INFO] APNS-Client[340]: Sending Batch ID=1, Count=1 2019-09-10 21:37:48.PM [INFO] APNS-Client[340]: Connecting (Batch ID=1) 2019-09-10 21:37:48.PM [INFO] APNS-Client[340]: Connected (Batch ID=1) 2019-09-10 21:37:48.PM [INFO] APNS-Client[340]: Sent Batch, waiting for possible response... 2019-09-10 21:37:49.PM [INFO] APNS-Client[340]: Received -1 bytes response... 2019-09-10 21:37:49.PM [INFO] APNS-Client[340]: Batch (ID=1) completed with no error response... 2019-09-10 21:37:49.PM [INFO] APNS-Client[340]: Done Reading for Batch ID=1, reseting batch timer... 2019-09-10 21:37:49.PM [INFO] All Tasks Finished 2019-09-10 21:37:49.PM [INFO] Passed WhenAll 2019-09-10 21:37:49.PM [INFO] Broker IsCompleted 2019-09-10 21:37:49.PM [DEBUG] Broker Task Ended 2019-09-10 21:37:49.PM [INFO] Stopping: Done Waiting on Tasks 2019-09-10 21:37:49.PM [DEBUG] Scaled Changed to: 1 2019-09-10 21:37:49.PM [INFO] Stopping: Waiting on Tasks 2019-09-10 21:37:49.PM [INFO] Waiting on all tasks 1 2019-09-10 21:37:50.PM [INFO] APNS-Client[341]: Sending Batch ID=1, Count=1 2019-09-10 21:37:50.PM [INFO] APNS-Client[341]: Connecting (Batch ID=1) 2019-09-10 21:37:52.PM [INFO] APNS-Client[341]: Connected (Batch ID=1) 2019-09-10 21:37:52.PM [INFO] APNS-Client[341]: Sent Batch, waiting for possible response... 2019-09-10 21:37:53.PM [INFO] APNS-Client[341]: Received -1 bytes response... 2019-09-10 21:37:53.PM [INFO] APNS-Client[341]: Batch (ID=1) completed with no error response... 2019-09-10 21:37:53.PM [INFO] APNS-Client[341]: Done Reading for Batch ID=1, reseting batch timer... 2019-09-10 21:37:53.PM [INFO] All Tasks Finished 2019-09-10 21:37:53.PM [INFO] Passed WhenAll 2019-09-10 21:37:53.PM [INFO] Broker IsCompleted 2019-09-10 21:37:53.PM [DEBUG] Broker Task Ended 2019-09-10 21:37:53.PM [INFO] Stopping: Done Waiting on Tasks 2019-09-10 21:37:53.PM [DEBUG] Scaled Changed to: 1 2019-09-10 21:37:53.PM [INFO] Stopping: Waiting on Tasks 2019-09-10 21:37:53.PM [INFO] Waiting on all tasks 1 2019-09-10 21:37:53.PM [INFO] All Tasks Finished 2019-09-10 21:37:53.PM [INFO] Passed WhenAll 2019-09-10 21:37:53.PM [INFO] Broker IsCompleted 2019-09-10 21:37:53.PM [DEBUG] Broker Task Ended 2019-09-10 21:37:53.PM [INFO] Stopping: Done Waiting on Tasks 2019-09-10 21:37:53.PM [DEBUG] Scaled Changed to: 1 2019-09-10 21:37:53.PM [INFO] Stopping: Waiting on Tasks 2019-09-10 21:37:53.PM [INFO] Waiting on all tasks 1 2019-09-10 21:37:53.PM [INFO] All Tasks Finished 2019-09-10 21:37:53.PM [INFO] Passed WhenAll 2019-09-10 21:37:53.PM [INFO] Broker IsCompleted 2019-09-10 21:37:53.PM [DEBUG] Broker Task Ended 2019-09-10 21:37:53.PM [INFO] Stopping: Done Waiting on Tasks 2019-09-10 21:37:53.PM [DEBUG] Scaled Changed to: 1 2019-09-10 21:37:53.PM [INFO] Stopping: Waiting on Tasks 2019-09-10 21:37:53.PM [INFO] Waiting on all tasks 1 2019-09-10 21:37:54.PM [INFO] APNS-Client[342]: Sending Batch ID=1, Count=1 2019-09-10 21:37:54.PM [INFO] APNS-Client[342]: Connecting (Batch ID=1) 2019-09-10 21:37:54.PM [INFO] APNS-Client[342]: Connected (Batch ID=1) 2019-09-10 21:37:54.PM [INFO] APNS-Client[342]: Sent Batch, waiting for possible response... 2019-09-10 21:37:55.PM [INFO] APNS-Client[342]: Received -1 bytes response... 2019-09-10 21:37:55.PM [INFO] APNS-Client[342]: Batch (ID=1) completed with no error response... 2019-09-10 21:37:55.PM [INFO] APNS-Client[342]: Done Reading for Batch ID=1, reseting batch timer... 2019-09-10 21:37:55.PM [INFO] All Tasks Finished 2019-09-10 21:37:55.PM [INFO] Passed WhenAll 2019-09-10 21:37:55.PM [INFO] Broker IsCompleted 2019-09-10 21:37:55.PM [DEBUG] Broker Task Ended 2019-09-10 21:37:55.PM [INFO] Stopping: Done Waiting on Tasks 2019-09-10 21:37:55.PM [DEBUG] Scaled Changed to: 1 2019-09-10 21:37:55.PM [INFO] Stopping: Waiting on Tasks 2019-09-10 21:37:55.PM [INFO] Waiting on all tasks 1 2019-09-10 21:37:55.PM [INFO] All Tasks Finished 2019-09-10 21:37:55.PM [INFO] Passed WhenAll 2019-09-10 21:37:55.PM [INFO] Broker IsCompleted 2019-09-10 21:37:55.PM [DEBUG] Broker Task Ended 2019-09-10 21:37:55.PM [INFO] Stopping: Done Waiting on Tasks 2019-09-10 21:37:55.PM [DEBUG] Scaled Changed to: 1 2019-09-10 21:37:55.PM [INFO] Stopping: Waiting on Tasks 2019-09-10 21:37:55.PM [INFO] Waiting on all tasks 1 2019-09-10 21:37:56.PM [INFO] APNS-Client[343]: Sending Batch ID=1, Count=1 2019-09-10 21:37:56.PM [INFO] APNS-Client[343]: Connecting (Batch ID=1) 2019-09-10 21:37:56.PM [INFO] APNS-Client[343]: Connected (Batch ID=1) 2019-09-10 21:37:56.PM [INFO] APNS-Client[343]: Sent Batch, waiting for possible response... 2019-09-10 21:37:57.PM [INFO] APNS-Client[343]: Received -1 bytes response... 2019-09-10 21:37:57.PM [INFO] APNS-Client[343]: Batch (ID=1) completed with no error response... 2019-09-10 21:37:57.PM [INFO] APNS-Client[343]: Done Reading for Batch ID=1, reseting batch timer... 2019-09-10 21:37:57.PM [INFO] All Tasks Finished 2019-09-10 21:37:57.PM [INFO] Passed WhenAll 2019-09-10 21:37:57.PM [INFO] Broker IsCompleted 2019-09-10 21:37:57.PM [DEBUG] Broker Task Ended 2019-09-10 21:37:57.PM [INFO] Stopping: Done Waiting on Tasks

jaoord commented 4 years ago

Take a look here to find out how to disable the console logger.

Relevant code in case link dies:

public void ConfigureServices(IServiceCollection services)
{
    services.AddLogging(config =>
    {
        // clear out default configuration
        config.ClearProviders();

        config.AddConfiguration(Configuration.GetSection("Logging"));
        config.AddDebug();
        config.AddEventSourceLogger();

        if(Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == EnvironmentName.Development) 
        {
            config.AddConsole();
        }
    });

    ... 
}