Skip to content

Commit

Permalink
check felix.log size in controller
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Nov 18, 2024
1 parent fde3cad commit de00fa5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
19 changes: 0 additions & 19 deletions core/src/main/java/lucee/runtime/config/ConfigWebFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
Expand Down Expand Up @@ -187,7 +186,6 @@ public final class ConfigWebFactory extends ConfigFactory {
private static final String TEMPLATE_EXTENSION = "cfm";
private static final String COMPONENT_EXTENSION = "cfc";
private static final String COMPONENT_EXTENSION_LUCEE = "lucee";
private static final long GB1 = 1024 * 1024 * 1024;
public static final boolean LOG = true;
private static final int DEFAULT_MAX_CONNECTION = 100;
public static final String DEFAULT_LOCATION = Constants.DEFAULT_UPDATE_URL.toExternalForm();
Expand Down Expand Up @@ -277,23 +275,6 @@ synchronized static void load(ConfigServerImpl config, Struct root, boolean isRe
if (createSaltAndPW(root, config, essentialOnly)) reload = true;
if (LOG) LogUtil.logGlobal(ThreadLocalPageContext.getConfig(config), Log.LEVEL_DEBUG, ConfigWebFactory.class.getName(), "fixed salt");

// delete to big felix.log (there is also code in the loader to do this, but if the loader is not
// updated ...)
if (!essentialOnly) {
try {
ConfigServerImpl _cs = config;
File rr = _cs.getEngine().getCFMLEngineFactory().getResourceRoot();
File log = new File(rr, "context/logs/felix.log");
if (log.isFile() && log.length() > GB1) {
if (log.delete()) ResourceUtil.touch(log);

}
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
log(config, null, t);
}
}
// reload when an old version of xml got updated
if (reload) {
root = reload(root, config, null);
Expand Down
16 changes: 16 additions & 0 deletions core/src/main/java/lucee/runtime/engine/Controler.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
**/
package lucee.runtime.engine;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
Expand Down Expand Up @@ -241,6 +242,21 @@ private void control(CFMLFactoryImpl[] factories, boolean firstRun, Log log) {
}
}

if (doHour) {
// check felix.log file size
try {
File rr = configServer.getEngine().getCFMLEngineFactory().getResourceRoot();
File felixLog = new File(rr, "context/logs/felix.log");
if (felixLog.isFile() && felixLog.length() > 1024 * 1024 * 1024) {
if (felixLog.delete()) ResourceUtil.touch(felixLog);
}
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
if (log != null) log.error("controler", t);
}
}

for (int i = 0; i < factories.length; i++) {
control(factories[i], do10Seconds, doMinute, doHour, firstRun, log);
}
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="7.0.0.46-SNAPSHOT"/>
<property name="version" value="7.0.0.47-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>7.0.0.46-SNAPSHOT</version>
<version>7.0.0.47-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit de00fa5

Please sign in to comment.