Package org.ejbca.core.model.log

Examples of org.ejbca.core.model.log.LogConfiguration


    /**
     * Internal implementation for logging. Does not allow Exceptions to propagate outside the logging functionality.
     */
    private void doLog(final Admin admin, final int caid, final int module, final Date time, final String username, final Certificate certificate, final int event, final String comment, final Exception ex) {
      final LogConfiguration config = logConfigurationSession.loadLogConfiguration(caid);
      final Iterator<ILogDevice> i = logdevices.iterator();
      while (i.hasNext()) {
        final ILogDevice dev = i.next();
        try {
            if (!dev.getAllowConfigurableEvents() || config.logEvent(event)) {
              dev.log(admin, caid, module, time, username, certificate, event, comment, ex);
            }
        } catch (Throwable e) { // NOPMD, we really want to catch every possible error from the log device
              LOG.error(INTRES.getLocalizedMessage("log.error.logdropped",admin.getAdminType()+" "+admin.getAdminData()+" "
                  +caid+" "+" "+module+" "+" "+time+" "+username+" "+(certificate==null?"null":CertTools.getSerialNumberAsString(certificate)+" "
View Full Code Here


    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    @Override
    public LogConfiguration loadLogConfiguration(final int caid) {
        // Try loading log configuration from cache
        LogConfiguration ret = logConfCache.get(Integer.valueOf(caid));
      if (ret == null) {
            // Try loading log configuration from database
        final LogConfigurationData logconfigdata = LogConfigurationData.findByPK(entityManager, Integer.valueOf(caid));
        if (logconfigdata != null) {
          ret = logconfigdata.loadLogConfiguration();
          logConfCache.put(Integer.valueOf(caid), ret);
        }
      }
    if (ret == null) {
      // Use the default object if nothing is configured
      ret = new LogConfiguration();
      logConfCache.put(Integer.valueOf(caid), ret);
    }
        return ret;
    }
View Full Code Here

    public int getAndIncrementRowCount() {
      // Read current value from LogConfigurationData with id=0
      final int currentLogEntryRowNumber = LogConfigurationData.findCurrentLogEntryRowNumber(entityManager);
      if (currentLogEntryRowNumber == -1) {
          // No such LogConfigurationData exists, so we create a new one with an updated logEntryRowNumber...
        final LogConfigurationData logConfigurationDataNew = new LogConfigurationData(0, new LogConfiguration());
        logConfigurationDataNew.setLogEntryRowNumber(1);
        entityManager.persist(logConfigurationDataNew);
        // ...and return 0, since we know that this is the first anyone has asked for.
        return 0;
      } else {
View Full Code Here

  public void testLogConfigurationData() {
    LOG.trace(">testLogConfigurationData");
    logMemStats();
    LogConfigurationData entity = new LogConfigurationData();
    entity.setId(BOGUS_INTEGER);
    entity.setLogConfigurationUnsafe(new LogConfiguration(false, false, HASHMAP_200K));
    entity.setLogEntryRowNumber(0);
    entity.setRowProtection(CLOB_10KiB);
    entity.setRowVersion(0);
    storeAndRemoveEntity(entity);
    LOG.trace("<testLogConfigurationData");
View Full Code Here

  public String getRowProtection() { return rowProtection; }
  public void setRowProtection(String rowProtection) { this.rowProtection = rowProtection; }

  @Transient
  public LogConfiguration loadLogConfiguration() {
    LogConfiguration logconfiguration = (LogConfiguration) getLogConfiguration();
    // Fill in new information from LogEntry constants.
    for (int i = 0; i < LogConstants.EVENTNAMES_INFO.length; i++) {
      if (logconfiguration.getLogEvent(i) == null) {
        logconfiguration.setLogEvent(i, true);
      }
    }
    for (int i = 0; i < LogConstants.EVENTNAMES_ERROR.length; i++) {
      int index = i + LogConstants.EVENT_ERROR_BOUNDRARY;

      if (logconfiguration.getLogEvent(index) == null) {
        logconfiguration.setLogEvent(index, true);
      }
    }
    return logconfiguration;
  }
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.log.LogConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.