Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 43e8572

Browse files
committed
Make number of rolling logfiles configurable
1 parent aa6f22e commit 43e8572

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ XX XXXXXXX XXXX - 1.3.3
120120
- White/Black list of file extensions
121121
- Fix bug where OWASP results not escaped
122122
- Add logout button to admin sections
123-
- Refactor JavaScript and remove bugs
123+
- Refactor JavaScript and fix bugs
124124
- Additional properties for controlling background threads
125125
- Fix off by 1 error where some results would not be shown
126126
- Admin can now selectively pause indexing
127127
- Ability to log out all indexed and excluded files to CSV
128-
- Set file rotation to have 10x10mb files
128+
- Set file rotation to have 10x10mb files by default but controlled through property
129129
- Add backoff setting to settings page to control CPU usage
130130
- Improve memory usage for large file repositories
131-
- Whitelist now trumps minified
131+
- Whitelist trumps minified logic
132132

133133
04 October 2016 - 1.3.2
134134
- Improve matching of certain strings such as E.G. linux2.7.4 or i386

searchcode.properties.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ only_localhost=false
1313
low_memory=false
1414
log_level=SEVERE
1515
log_path=./logs
16+
log_count=10
1617
spelling_corrector_size=10000
1718
max_document_queue_size=1000
1819
max_document_queue_line_size=100000

src/main/java/com/searchcode/app/config/Values.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ public class Values {
8080
public static String DEFAULT_AND_MATCH = "true";
8181
public static String LOG_INDEXED = "log_indexed";
8282
public static String DEFAULT_LOG_INDEXED = "false";
83+
public static String LOG_COUNT = "log_count";
84+
public static String DEFAULT_LOG_COUNT = "10";
85+
public static String LOG_LEVEL = "log_level";
86+
public static String DEFAULT_LOG_LEVEL = "SEVERE";
8387

8488
// Lucene stored values for indexing / searching
8589
public static String CONTENTS = "contents";

src/main/java/com/searchcode/app/util/LoggerWrapper.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,25 @@
2828
public class LoggerWrapper {
2929

3030
private Logger logger = null;
31-
3231
private EvictingQueue allCache = null;
33-
3432
private EvictingQueue infoRecentCache = null;
35-
3633
private EvictingQueue warningRecentCache = null;
37-
3834
private EvictingQueue severeRecentCache = null;
39-
4035
private EvictingQueue searchLog = null;
4136

4237
public int BYTESLOGSIZE = 10 * 1024 * 1024;
43-
4438
public int LOGCOUNT = 10;
4539

4640
public LoggerWrapper() {
41+
this.LOGCOUNT = Helpers.tryParseInt((String)Properties.getProperties().getOrDefault(Values.LOG_COUNT, Values.DEFAULT_LOG_COUNT), Values.DEFAULT_LOG_COUNT);
42+
4743
String path = Values.EMPTYSTRING;
4844
try {
4945
path = Helpers.getLogPath();
50-
5146
path += "searchcode-server-%g.log";
5247
Handler handler = new FileHandler(path, this.BYTESLOGSIZE, this.LOGCOUNT);
5348

54-
String logLevel = (String) Properties.getProperties().getOrDefault("log_level", "severe");
49+
String logLevel = (String)Properties.getProperties().getOrDefault(Values.LOG_LEVEL, Values.DEFAULT_LOG_LEVEL);
5550

5651
handler.setFormatter(new SimpleFormatter());
5752

src/main/resources/spark/template/freemarker/documentation.ftl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,8 @@ print data['sucessful'], data['message']</textarea>
569569
<dd>If you enable use_system_git you need to ensure that this equals the path to your git executable for your system. By default set to /usr/bin/git</dd>
570570
<dt>log_level</dt>
571571
<dd>What level of logging is requested both to STDOUT and the default log file. Accepts the uppercase values of INFO, WARNING, SEVERE or OFF. By default set to SEVERE. Critical warnings will still be printed to STDOUT.</dd>
572+
<dt>log_count</dt>
573+
<dd>How many rolling log files to keep. By default set to 10.</dd>
572574
<dt>api_enabled</dt>
573575
<dd>Boolean value true or false. Should the searchcode server API be enabled. By default set to false.</dd>
574576
<dt>api_key_authentication</dt>

0 commit comments

Comments
 (0)