1- using log4net ;
2- using log4net . Appender ;
3- using log4net . Core ;
4- using log4net . Filter ;
5- using log4net . Layout ;
6- using log4net . Repository . Hierarchy ;
71using System ;
82using System . Collections . Generic ;
93using System . IO ;
@@ -13,15 +7,12 @@ namespace BrowserStack
137{
148 public class Local
159 {
16- private Hierarchy hierarchy ;
1710 private string folder = "" ;
1811 private string accessKey = "" ;
1912 private string customLogPath = "" ;
2013 private string argumentString = "" ;
2114 private string customBinaryPath = "" ;
22- private PatternLayout patternLayout ;
2315 protected BrowserStackTunnel tunnel = null ;
24- public static ILog logger = LogManager . GetLogger ( "Local" ) ;
2516 private static KeyValuePair < string , string > emptyStringPair = new KeyValuePair < string , string > ( ) ;
2617
2718 private static List < KeyValuePair < string , string > > valueCommands = new List < KeyValuePair < string , string > > ( ) {
@@ -40,7 +31,6 @@ public class Local
4031 new KeyValuePair < string , string > ( "forceproxy" , "-forceproxy" ) ,
4132 new KeyValuePair < string , string > ( "onlyAutomate" , "-onlyAutomate" ) ,
4233 } ;
43- private readonly string LOG4NET_CONFIG_FILE_PATH = Path . Combine ( Directory . GetCurrentDirectory ( ) , "log_config.xml" ) ;
4434
4535 public bool isRunning ( )
4636 {
@@ -102,34 +92,9 @@ private void addArgs(string key, string value)
10292 }
10393 }
10494 }
105- private void setupLogging ( )
106- {
107- hierarchy = ( Hierarchy ) LogManager . GetRepository ( ) ;
108-
109- patternLayout = new PatternLayout ( ) ;
110- patternLayout . ConversionPattern = "%date [%thread] %-5level %logger - %message%newline" ;
111- patternLayout . ActivateOptions ( ) ;
112-
113- ConsoleAppender consoleAppender = new ConsoleAppender ( ) ;
114- consoleAppender . Threshold = Level . Info ;
115- consoleAppender . Layout = patternLayout ;
116- consoleAppender . ActivateOptions ( ) ;
117-
118- LoggerMatchFilter loggerMatchFilter = new LoggerMatchFilter ( ) ;
119- loggerMatchFilter . LoggerToMatch = "Local" ;
120- loggerMatchFilter . AcceptOnMatch = true ;
121- consoleAppender . AddFilter ( loggerMatchFilter ) ;
122- consoleAppender . AddFilter ( new DenyAllFilter ( ) ) ;
123-
124- hierarchy . Root . AddAppender ( consoleAppender ) ;
125-
126- hierarchy . Root . Level = Level . All ;
127- hierarchy . Configured = true ;
128- }
12995
13096 public Local ( )
13197 {
132- setupLogging ( ) ;
13398 tunnel = new BrowserStackTunnel ( ) ;
13499 }
135100 public void start ( List < KeyValuePair < string , string > > options )
@@ -166,7 +131,6 @@ public void start(List<KeyValuePair<string, string>> options)
166131 tunnel . Run ( accessKey , folder , customLogPath , "start" ) ;
167132 } catch ( Exception )
168133 {
169- logger . Warn ( "Running Local failed. Falling back to backup path." ) ;
170134 except = true ;
171135 }
172136 if ( except )
0 commit comments