Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display environment variables (#489) #867

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public class JavaInformations implements Serializable { // NOPMD
private final String webappVersion;
private final Date startDate;
private final String jvmArguments;
private final String environmentVariables;
private final long freeDiskSpaceInTemp;
private final int threadCount;
private final int peakThreadCount;
Expand Down Expand Up @@ -187,6 +188,8 @@ public JavaInformations(ServletContext servletContext, boolean includeDetails) {
}
startDate = START_DATE;
jvmArguments = buildJvmArguments();
environmentVariables = buildEnvironmentsVariables();

final ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
threadCount = threadBean.getThreadCount();
peakThreadCount = threadBean.getPeakThreadCount();
Expand Down Expand Up @@ -320,6 +323,14 @@ private static String buildJvmArguments() {
return jvmArgs.toString();
}

private static String buildEnvironmentsVariables() {
final StringBuilder sysEnvVariables = new StringBuilder();
for (Map.Entry<String, String> sysEnvVariableEntry : System.getenv().entrySet()) {
sysEnvVariables.append(String.format("%s = %s\n", sysEnvVariableEntry.getKey(), sysEnvVariableEntry.getValue()));
}
return sysEnvVariables.toString();
}

public static List<ThreadInformations> buildThreadInformationsList() {
final ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
final Map<Thread, StackTraceElement[]> stackTraces = Thread.getAllStackTraces();
Expand Down Expand Up @@ -607,6 +618,10 @@ public String getJvmArguments() {
return jvmArguments;
}

public String getEnvironmentVariables() {
return environmentVariables;
}

public long getFreeDiskSpaceInTemp() {
return freeDiskSpaceInTemp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ private void writeDetails(JavaInformations javaInformations, boolean repeatHost)
writeln(columnEnd);
}

write("<tr><td valign='top'>#Environment_variables#: </td><td>");
writeDirectly(htmlEncodeButNotSpace(javaInformations.getEnvironmentVariables()) + columnEnd);

writeTomcatInformations(javaInformations.getTomcatInformationsList());

writeMemoryInformations(javaInformations.getMemoryInformations());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ private void writeDetails(JavaInformations javaInformations)
addCell(getString("httpSessionsMeanAge") + ':');
addCell(integerFormat.format(javaInformations.getSessionMeanAgeInMinutes()));
}
addCell(getString("Environment_variables") + ':');
addCell(javaInformations.getEnvironmentVariables());

writeTomcatInformations(javaInformations.getTomcatInformationsList());
addCell(getString("Gestion_memoire") + ':');
writeMemoryInformations(javaInformations.getMemoryInformations());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ Serveur=Server
Contexte_webapp=Webapp context
Demarrage=Start
Arguments_JVM=JVM arguments
Environment_variables=Environment variables
Gestion_memoire=Memory
Free_disk_space=Free disk space
Base_de_donnees=DataBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ramasse_miette=Spustit garbage collector
buildsSystemErrors=% stav\u00ED chyby
Application_disponible=Aplikace dostupn\u00E1
Arguments_JVM=JVM argumenty
Environment_variables=Prom\u011Bnn\u00E9 prost\u0159ed\u00ED
sur=dne {0}
Aucune_session=\u017D\u00E1dn\u00FD
errorHitsRate=Http syst\u00E9mov\u00E9 chyby za minutu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ Serveur=Server
Contexte_webapp=Webapp Kontext
Demarrage=Start
Arguments_JVM=JVM arguments
Environment_variables=Umgebungsvariablen
Gestion_memoire=Speicher
Free_disk_space=Freier Festplattenspeicher
Base_de_donnees=Datenbank
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ Serveur=Serveur
Contexte_webapp=Contexte webapp
Demarrage=D�marrage
Arguments_JVM=Arguments JVM
Environment_variables=Variables d'environnement
Gestion_memoire=Gestion m�moire
Free_disk_space=Espace disque libre
Base_de_donnees=Base de donn�es
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ramasse_miette=Esegui il garbage collector
buildsSystemErrors=% di errori di compilazione
Application_disponible=Applicazione disponibile
Arguments_JVM=Argomenti JVM
Environment_variables=Variabili ambientali
sur=su {0}
Aucune_session=Nessuno
errorHitsRate=Errori http di sistema al minuto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ Serveur=Servidor
Contexte_webapp=Contexto WebApp
Demarrage=In�cio
Arguments_JVM=Argumentos da JVM
Environment_variables=Vari�veis ambientais
Gestion_memoire=Mem�ria
Free_disk_space=Espa�o livre em disco
Base_de_donnees=Banco de dados
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ Contenu=\u0412\u043C\u0456\u0441\u0442
JobPaused=\u041F\u0440\u0438\u0437\u0443\u043F\u0438\u043D\u0435\u043D\u043E
guiceSystemErrors=% \u043F\u043E\u043C\u0438\u043B\u043E\u043A \u0432 \u0433\u0432\u0456\u0441\u043A\u0430\u0445
Arguments_JVM=\u0410\u0440\u0433\u0443\u043C\u0435\u043D\u0442\u0438 JVM
Environment_variables=\u0417\u043C\u0456\u043D\u043D\u0456 \u0441\u0435\u0440\u0435\u0434\u043E\u0432\u0438\u0449\u0430
springSystemErrors=% \u043F\u043E\u043C\u0438\u043B\u043E\u043A \u043D\u0430\u0432\u0435\u0441\u043D\u0456
Tout_montrer=\u0420\u043E\u0437\u0433\u043E\u0440\u043D\u0443\u0442\u0438 \u0432\u0441\u0435
data_unavailable=\u0414\u0430\u043D\u0456, \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0456 \u0434\u043B\u044F \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u0438 {0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Arbre_JNDI_pour_contexte = JNDI \u6811\u7684\u5177\u4F53\u5185\u5BB9 {0}

Arguments_JVM = \u865A\u62DF\u673A\u53C2\u6570

Environment_variables = \u73AF\u5883\u53D8\u91CF

Attributs = \u5C5E\u6027

Aucun_job = \u7A7A
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ private void addDetails(boolean repeatHost) {
addValue(integerFormat.format(javaInformations.getSessionMeanAgeInMinutes()));
}

addLabel(getString("Environment_variables"));
addValue(javaInformations.getEnvironmentVariables());

writeTomcatInformations(javaInformations.getTomcatInformationsList());

writeMemoryInformations(javaInformations.getMemoryInformations());
Expand Down