/** * Sets the agent name and re-initializes the logging so that the agentName is used as folder * for logging. * * @param agentName * Agent name. */ public static void setAgentNameAndInitLogging(String agentName) { File agentJar = SpringAgent.getInspectitJarFile(); if (null == agentJar) { return; } // set the location of logs based to agent name logDirLocation = agentJar.getParent() + File.separator + "logs" + File.separator + agentName; initLogging(); }
/** * {@inheritDoc} */ @Override public final void setAgentName(String name) throws StorageException { if ((null == name) || "".equals(name)) { throw new StorageException("Agent name cannot be null or empty!"); } // don't allow reseting if (null == agentName) { agentName = name; // when we know the name init the logging LogInitializer.setAgentNameAndInitLogging(name); } if (log.isInfoEnabled()) { log.info("Agent name set to: " + name); } }
/** * Constructor initializing this agent. * * @param inspectitJarFile * The inspectIT jar file needed for proper logging * @param instrumentation * The {@link Instrumentation} to use */ public SpringAgent(File inspectitJarFile, Instrumentation instrumentation) { this.instrumentation = instrumentation; setInspectITJarFile(inspectitJarFile); // init logging LogInitializer.initLogging(); // init spring this.initSpring(); }