@Test public void testLogNullProperty() throws Exception { User user = associateUser(request); MockHttpServletRequest request2 = mockRequest(MONITORED_ADDR); User user2 = associateUser(request2); GroupChainId id = new GroupChainId("test"); MessageEntry entry = new MessageEntry("test"); context.log(null, id, entry); verify(registry.getLogger(user), times(1)).log(entry); verify(registry.getLogger(user2), times(1)).log(entry); }
public void log(Level level, GroupChainId id, Entry entry) { if(Level.SCOPED.equals(level)) { scopedEntryQueue.add(new EntryHolder(id, entry)); } if(!isMonitored()) { return; } if(level == null) { level = Level.ALL; } try { List<ResponseLoggerService> loggers = registry.getContextLoggers(entryPoint); if(Level.SCOPED.equals(level)) { for(ResponseLoggerService logger : loggers) { Preferences preferences = logger.getPreferences(); synchronized (this) { if(requestScoped.contains(logger) || !preferences.isEnabled(GeneralPreferenceEnum.SCOPE_ENABLED.getPropertyName())) { doLog(logger, Level.SCOPED, id, entry); if(!requestScoped.contains(logger)) { logger.addStopListener(new StoppedLoggerHandler(logger)); requestScoped.add(logger); } } } } return; } for(ResponseLoggerService logger : loggers) { Preferences preferences = logger.getPreferences(); if(Level.ALL.equals(level)) { doLog(logger, level, id, entry); } else if(RegexLevelEntryAware.class.isInstance(entry)) { if(preferences.isRegexEnabled(level.getName())) { doLog(logger, level, id, entry); } } else if(preferences.isEnabled(level.getName())) { doLog(logger, level, id, entry); } } } catch (Exception e) { LOG.warn(e.getMessage(), e); } }
PirasoContext implements ContextPreference { public void log(Level level, GroupChainId id, Entry entry) { if(Level.SCOPED.equals(level)) { scopedEntryQueue.add(new EntryHolder(id, entry)); } if(!isMonitored()) { return; } if(level == null) { level = Level.ALL; } try { List<ResponseLoggerService> loggers = registry.getContextLoggers(entryPoint); if(Level.SCOPED.equals(level)) { for(ResponseLoggerService logger : loggers) { Preferences preferences = logger.getPreferences(); synchronized (this) { if(requestScoped.contains(logger) || !preferences.isEnabled(GeneralPreferenceEnum.SCOPE_ENABLED.getPropertyName())) { doLog(logger, Level.SCOPED, id, entry); if(!requestScoped.contains(logger)) { logger.addStopListener(new StoppedLoggerHandler(logger)); requestScoped.add(logger); } } } } return; } for(ResponseLoggerService logger : loggers) { Preferences preferences = logger.getPreferences(); if(Level.ALL.equals(level)) { doLog(logger, level, id, entry); } else if(RegexLevelEntryAware.class.isInstance(entry)) { if(preferences.isRegexEnabled(level.getName())) { doLog(logger, level, id, entry); } } else if(preferences.isEnabled(level.getName())) { doLog(logger, level, id, entry); } } } catch (Exception e) { LOG.warn(e.getMessage(), e); } } }
PirasoContext implements ContextPreference { public void log(Level level, GroupChainId id, Entry entry) { if(Level.SCOPED.equals(level)) { scopedEntryQueue.add(new EntryHolder(id, entry)); } if(!isMonitored()) { return; } if(level == null) { level = Level.ALL; } try { List<ResponseLoggerService> loggers = registry.getContextLoggers(entryPoint); if(Level.SCOPED.equals(level)) { for(ResponseLoggerService logger : loggers) { Preferences preferences = logger.getPreferences(); synchronized (this) { if(requestScoped.contains(logger) || !preferences.isEnabled(GeneralPreferenceEnum.SCOPE_ENABLED.getPropertyName())) { doLog(logger, Level.SCOPED, id, entry); if(!requestScoped.contains(logger)) { logger.addStopListener(new StoppedLoggerHandler(logger)); requestScoped.add(logger); } } } } return; } for(ResponseLoggerService logger : loggers) { Preferences preferences = logger.getPreferences(); if(Level.ALL.equals(level)) { doLog(logger, level, id, entry); } else if(RegexLevelEntryAware.class.isInstance(entry)) { if(preferences.isRegexEnabled(level.getName())) { doLog(logger, level, id, entry); } } else if(preferences.isEnabled(level.getName())) { doLog(logger, level, id, entry); } } } catch (Exception e) { LOG.warn(e.getMessage(), e); } } PirasoContext(PirasoEntryPoint entryPoint);  PirasoContext(PirasoEntryPoint entryPoint, LoggerRegistry registry);  PirasoContext(PirasoEntryPoint entryPoint, LoggerRegistry registry, ReferenceRequestEntry ref); private  PirasoContext(long requestId, PirasoEntryPoint entryPoint, LoggerRegistry registry, ReferenceRequestEntry ref, GroupChainId refGroupChainId); }
PirasoContext implements ContextPreference { public void log(Level level, GroupChainId id, Entry entry) { if(Level.SCOPED.equals(level)) { scopedEntryQueue.add(new EntryHolder(id, entry)); } if(!isMonitored()) { return; } if(level == null) { level = Level.ALL; } try { List<ResponseLoggerService> loggers = registry.getContextLoggers(entryPoint); if(Level.SCOPED.equals(level)) { for(ResponseLoggerService logger : loggers) { Preferences preferences = logger.getPreferences(); synchronized (this) { if(requestScoped.contains(logger) || !preferences.isEnabled(GeneralPreferenceEnum.SCOPE_ENABLED.getPropertyName())) { doLog(logger, Level.SCOPED, id, entry); if(!requestScoped.contains(logger)) { logger.addStopListener(new StoppedLoggerHandler(logger)); requestScoped.add(logger); } } } } return; } for(ResponseLoggerService logger : loggers) { Preferences preferences = logger.getPreferences(); if(Level.ALL.equals(level)) { doLog(logger, level, id, entry); } else if(RegexLevelEntryAware.class.isInstance(entry)) { if(preferences.isRegexEnabled(level.getName())) { doLog(logger, level, id, entry); } } else if(preferences.isEnabled(level.getName())) { doLog(logger, level, id, entry); } } } catch (Exception e) { LOG.warn(e.getMessage(), e); } } PirasoContext(PirasoEntryPoint entryPoint);  PirasoContext(PirasoEntryPoint entryPoint, LoggerRegistry registry);  PirasoContext(PirasoEntryPoint entryPoint, LoggerRegistry registry, ReferenceRequestEntry ref); private  PirasoContext(long requestId, PirasoEntryPoint entryPoint, LoggerRegistry registry, ReferenceRequestEntry ref, GroupChainId refGroupChainId); PirasoContext createChildContext(GroupChainId chainId); void setIndent(int indent); int getIndent(); void addProperty(Class<?> clazz, String name, Object value); void removeProperty(Class<?> clazz, String name); Object getProperty(Class<?> clazz, String name); Long getRequestId(); ReferenceRequestEntry getRef(); PirasoEntryPoint getEntryPoint(); boolean isMonitored(); boolean isRegexEnabled(String property); boolean isEnabled(String property); Integer getIntValue(String property); void log(Level level, GroupChainId id, Entry entry); }
PirasoContext implements ContextPreference { public void log(Level level, GroupChainId id, Entry entry) { if(Level.SCOPED.equals(level)) { scopedEntryQueue.add(new EntryHolder(id, entry)); } if(!isMonitored()) { return; } if(level == null) { level = Level.ALL; } try { List<ResponseLoggerService> loggers = registry.getContextLoggers(entryPoint); if(Level.SCOPED.equals(level)) { for(ResponseLoggerService logger : loggers) { Preferences preferences = logger.getPreferences(); synchronized (this) { if(requestScoped.contains(logger) || !preferences.isEnabled(GeneralPreferenceEnum.SCOPE_ENABLED.getPropertyName())) { doLog(logger, Level.SCOPED, id, entry); if(!requestScoped.contains(logger)) { logger.addStopListener(new StoppedLoggerHandler(logger)); requestScoped.add(logger); } } } } return; } for(ResponseLoggerService logger : loggers) { Preferences preferences = logger.getPreferences(); if(Level.ALL.equals(level)) { doLog(logger, level, id, entry); } else if(RegexLevelEntryAware.class.isInstance(entry)) { if(preferences.isRegexEnabled(level.getName())) { doLog(logger, level, id, entry); } } else if(preferences.isEnabled(level.getName())) { doLog(logger, level, id, entry); } } } catch (Exception e) { LOG.warn(e.getMessage(), e); } } PirasoContext(PirasoEntryPoint entryPoint);  PirasoContext(PirasoEntryPoint entryPoint, LoggerRegistry registry);  PirasoContext(PirasoEntryPoint entryPoint, LoggerRegistry registry, ReferenceRequestEntry ref); private  PirasoContext(long requestId, PirasoEntryPoint entryPoint, LoggerRegistry registry, ReferenceRequestEntry ref, GroupChainId refGroupChainId); PirasoContext createChildContext(GroupChainId chainId); void setIndent(int indent); int getIndent(); void addProperty(Class<?> clazz, String name, Object value); void removeProperty(Class<?> clazz, String name); Object getProperty(Class<?> clazz, String name); Long getRequestId(); ReferenceRequestEntry getRef(); PirasoEntryPoint getEntryPoint(); boolean isMonitored(); boolean isRegexEnabled(String property); boolean isEnabled(String property); Integer getIntValue(String property); void log(Level level, GroupChainId id, Entry entry); static final String INDENT_PROPERTY; }