Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
minerva
core
Commits
175ce5a9
Commit
175ce5a9
authored
6 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
there is posibility to have log4j.properties in the external /etc/minerva/log4j.properties file
parent
6eb5553e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!630
WIP: Resolve "The privileges of a new user are not saved in some cases"
,
!424
Resolve "log4j configuration should be exposed to the user"
Pipeline
#6577
failed
6 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
web/src/main/java/lcsb/mapviewer/bean/utils/StartupBean.java
+24
-0
24 additions, 0 deletions
web/src/main/java/lcsb/mapviewer/bean/utils/StartupBean.java
with
24 additions
and
0 deletions
web/src/main/java/lcsb/mapviewer/bean/utils/StartupBean.java
+
24
−
0
View file @
175ce5a9
package
lcsb.mapviewer.bean.utils
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.Properties
;
import
javax.annotation.PostConstruct
;
import
javax.faces.bean.ApplicationScoped
;
...
...
@@ -10,6 +14,7 @@ import javax.faces.context.FacesContext;
import
javax.servlet.ServletContext
;
import
org.apache.log4j.Logger
;
import
org.apache.log4j.PropertyConfigurator
;
import
lcsb.mapviewer.common.Configuration
;
import
lcsb.mapviewer.common.IProgressUpdater
;
...
...
@@ -69,6 +74,7 @@ public class StartupBean {
*/
@PostConstruct
public
void
init
()
{
loadCustomLog4jProperties
();
logger
.
debug
(
"Application startup script starts"
);
ServletContext
servletContext
=
(
ServletContext
)
FacesContext
.
getCurrentInstance
().
getExternalContext
()
.
getContext
();
...
...
@@ -81,6 +87,24 @@ public class StartupBean {
logger
.
debug
(
"Application startup script ends"
);
}
private
void
loadCustomLog4jProperties
()
{
String
filename
=
"/etc/minerva/log4j.properties"
;
File
file
=
new
File
(
filename
);
if
(
file
.
exists
())
{
try
{
Properties
props
=
new
Properties
();
InputStream
configStream
=
new
FileInputStream
(
file
);
props
.
load
(
configStream
);
configStream
.
close
();
PropertyConfigurator
.
configure
(
props
);
logger
.
info
(
"log4j configuration loaded from: "
+
filename
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"Problem with loading log4j configuration: "
+
filename
);
}
}
}
private
void
setSessionLength
()
{
try
{
String
sessionLength
=
configurationService
.
getConfigurationValue
(
ConfigurationElementType
.
SESSION_LENGTH
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment