HttpConnector(TraceeLoggerFactory loggerFactory, AsyncHttpClientProvider asyncHttpClientProvider) { this.asyncHttpClientProvider = asyncHttpClientProvider; logger = loggerFactory.getLogger(HttpConnector.class); }
/** * Writes a given log message. * * @param clazz the type used to get the logger for * @param logMessage the log message to write */ public void writeLogMessage(final Class clazz, final String logMessage) { TraceeLogger logger = Tracee.getBackend().getLoggerFactory().getLogger(clazz); }
public LogConnector() { this(Tracee.getBackend().getLoggerFactory().getLogger(LogConnector.class)); }
public LogConnector() { this(Tracee.getBackend().getLoggerFactory().getLogger(LogConnector.class)); }
private static void logWarn(final String message) { Tracee.getBackend().getLoggerFactory().getLogger(TypeToWrapper.class).warn(message); } }
private static void logError(final String message, final Throwable e) { Tracee.getBackend().getLoggerFactory().getLogger(TypeToWrapper.class).error(message, e); }
/** * Gets the profile defined via the system properties. * @return returns the profile defined via the system properties. Returns null if property is not set or set to an invalid value */ static Profile getProfileFromSystemProperties() { Profile result = null; // try to get system property String systemPropertyProfileName = System.getProperty(ProfilePropertyNames.PROFILE_SET_GLOBALLY_VIA_SYSTEM_PROPERTIES); if (systemPropertyProfileName != null) { // try to convert String to enum value try { result = Profile.valueOf(systemPropertyProfileName); } catch (IllegalArgumentException e) { Tracee.getBackend().getLoggerFactory().getLogger(Profile.class).warn("Tracee ContextLoggerBuilder profile property ('" + ProfilePropertyNames.PROFILE_SET_GLOBALLY_VIA_SYSTEM_PROPERTIES + "') is set to the invalid value '" + systemPropertyProfileName + "' ==> Use default profile"); } } return result; }
/** * Gets the profile defined via the system properties. * * @return returns the profile defined via the system properties. Returns null if property is not set or set to an invalid value */ static Profile getProfileFromSystemProperties() { Profile result = null; // try to get system property String systemPropertyProfileName = System.getProperty(ProfilePropertyNames.PROFILE_SET_GLOBALLY_VIA_SYSTEM_PROPERTIES); if (systemPropertyProfileName != null) { // try to convert String to enum value try { result = Profile.valueOf(systemPropertyProfileName); } catch (IllegalArgumentException e) { Tracee.getBackend().getLoggerFactory().getLogger(Profile.class).warn("Tracee ContextLoggerBuilder profile property ('" + ProfilePropertyNames.PROFILE_SET_GLOBALLY_VIA_SYSTEM_PROPERTIES + "') is set to the invalid value '" + systemPropertyProfileName + "' ==> Use default profile"); } } return result; }
/** * Gets the profile defined via the system properties. * @return returns the profile defined via the system properties or {@code null} if property is not set or set to an invalid value. */ static Profile getProfileFromFileInClasspath(final String filename) { Profile result = null; try { Properties properties = openProperties(filename); if (properties != null) { String profileFromProperties = properties.getProperty(ProfilePropertyNames.PROFILE_SET_BY_FILE_IN_CLASSPATH_PROPERTY); if (profileFromProperties != null) { // try to convert String to enum value try { result = Profile.valueOf(profileFromProperties); } catch (IllegalArgumentException e) { Tracee.getBackend().getLoggerFactory().getLogger(Profile.class).warn( "Tracee custom ContextLoggerBuilder profile property ('" + ProfilePropertyNames.PROFILE_SET_BY_FILE_IN_CLASSPATH_PROPERTY + "') is set to the invalid value '" + profileFromProperties + "' and will be ignored" ); } } } } catch (IOException e) { // ignore it } return result; }
/** * Gets the profile defined via the system properties. * * @return returns the profile defined via the system properties or {@code null} if property is not set or set to an invalid value. */ static Profile getProfileFromFileInClasspath(final String filename) { Profile result = null; try { Properties properties = openProperties(filename); if (properties != null) { String profileFromProperties = properties.getProperty(ProfilePropertyNames.PROFILE_SET_BY_FILE_IN_CLASSPATH_PROPERTY); if (profileFromProperties != null) { // try to convert String to enum value try { result = Profile.valueOf(profileFromProperties); } catch (IllegalArgumentException e) { Tracee.getBackend().getLoggerFactory().getLogger(Profile.class).warn( "Tracee custom ContextLoggerBuilder profile property ('" + ProfilePropertyNames.PROFILE_SET_BY_FILE_IN_CLASSPATH_PROPERTY + "') is set to the invalid value '" + profileFromProperties + "' and will be ignored" ); } } } } catch (IOException e) { // ignore it } return result; }
public static void main(final String[] args) throws MalformedURLException { final TraceeLogger traceeLogger = traceeBackend.getLoggerFactory().getLogger(TestClient.class);