@ Command ( name = "AddLoggingTarget" , inTypeDesc = "Str[i]=Device-name. Str[i+1]=Target-type::Target-name" ) public void addLoggingTarget ( final String [ ] argin ) throws DevFailed { if ( argin . length % 2 != 0 ) { throw DevFailedUtils . newDevFailed ( INPUT_ERROR , "argin must be of even size" ) ; } for ( int i = 0 ; i < argin . length - 1 ; i = i + 2 ) { final String deviceName = argin [ i ] ; final String [ ] config = argin [ i + 1 ] . split ( LoggingManager . LOGGING_TARGET_SEPARATOR ) ; if ( config . length != 2 ) { throw DevFailedUtils . newDevFailed ( INPUT_ERROR , "config must be of size 2: targetType::targetName" ) ; } if ( config [ 0 ] . equalsIgnoreCase ( LoggingManager . LOGGING_TARGET_DEVICE ) ) { Class < ? > className = null ; for ( final DeviceClassBuilder deviceClass : classList ) { if ( deviceClass . containsDevice ( deviceName ) ) { className = deviceClass . getDeviceClass ( ) ; break ; } } if ( className != null ) { LoggingManager . getInstance ( ) . addDeviceAppender ( config [ 1 ] , className , deviceName ) ; } } else { LoggingManager . getInstance ( ) . addFileAppender ( config [ 1 ] , deviceName ) ; } } }
Send logs to a device