Revision 41957
Added by Michele Artini over 8 years ago
modules/dnet-msro-service/trunk/src/main/java/eu/dnetlib/msro/logging/LogMessage.java | ||
---|---|---|
24 | 24 |
} |
25 | 25 |
|
26 | 26 |
public LogMessage addDetail(final String name, final String value) { |
27 |
if (StringUtils.isNotBlank(name)) { |
|
27 |
if (StringUtils.isNotBlank(name) && value != null) {
|
|
28 | 28 |
this.details.put(name, value); |
29 | 29 |
} |
30 | 30 |
return this; |
... | ... | |
32 | 32 |
|
33 | 33 |
public LogMessage addDetails(final Map<String, String> map) { |
34 | 34 |
if (map != null) { |
35 |
this.details.putAll(map);
|
|
35 |
map.entrySet().forEach(e -> addDetail(e.getKey(), e.getValue()));
|
|
36 | 36 |
} |
37 | 37 |
return this; |
38 | 38 |
} |
modules/dnet-msro-service/trunk/src/main/java/eu/dnetlib/msro/workflows/procs/ProcessEngine.java | ||
---|---|---|
15 | 15 |
import org.apache.commons.logging.LogFactory; |
16 | 16 |
import org.springframework.beans.factory.annotation.Required; |
17 | 17 |
|
18 |
import com.google.common.base.Function; |
|
19 | 18 |
import com.google.common.base.Throwables; |
20 | 19 |
import com.google.common.collect.Maps; |
21 | 20 |
|
... | ... | |
214 | 213 |
} |
215 | 214 |
} |
216 | 215 |
|
217 |
final Map<String, String> details = Maps.transformValues(mergeEnvParams(process.getEnv(), token.getEnv()), new Function<Object, String>() { |
|
216 |
final Map<String, String> details = |
|
217 |
Maps.transformValues(filterOutputParams(mergeEnvParams(process.getEnv(), token.getEnv())), v -> v != null ? v.toString() : null); |
|
218 | 218 |
|
219 |
@Override |
|
220 |
public String apply(final Object o) { |
|
221 |
return o != null ? o.toString() : "NULL"; |
|
222 |
} |
|
223 |
}); |
|
224 |
|
|
225 |
this.dnetLogger.newLogMessage().addDetails(details).addDetails(process.calculateLogDetails()).flush(); |
|
219 |
this.dnetLogger.newLogMessage() |
|
220 |
.addDetails(details) |
|
221 |
.addDetail(WorkflowsConstants.LOG_WF_NAME, process.getName()) |
|
222 |
.addDetail(WorkflowsConstants.LOG_WF_FAMILY, process.getFamily()) |
|
223 |
.addDetail(WorkflowsConstants.LOG_WF_PRIORITY, "" + process.getPriority()) |
|
224 |
.addDetail(WorkflowsConstants.LOG_WF_PROCESS_ID, process.getId()) |
|
225 |
.addDetail(WorkflowsConstants.LOG_WF_PROCESS_STATUS, process.getStatus().toString()) |
|
226 |
.addDetail(WorkflowsConstants.LOG_WF_PROFILE_ID, process.isTemplate() ? null : process.getProfileId()) |
|
227 |
.addDetail(WorkflowsConstants.LOG_WF_PROFILE_TEMPLATE_ID, process.isTemplate() ? process.getProfileId() : null) |
|
228 |
.addDetail(WorkflowsConstants.LOG_DATASOURCE_ID, process.getDsId()) |
|
229 |
.addDetail(WorkflowsConstants.LOG_DATASOURCE_NAME, process.getDsName()) |
|
230 |
.addDetail(WorkflowsConstants.LOG_DATASOURCE_INTERFACE, process.getDsInterface()) |
|
231 |
.addDetail(WorkflowsConstants.LOG_SYSTEM_ERROR, process.getError()) |
|
232 |
.addDetail(WorkflowsConstants.LOG_SYSTEM_ERROR_STACKTRACE, process.getErrorStacktrace()) |
|
233 |
.flush(); |
|
226 | 234 |
} |
227 | 235 |
|
228 | 236 |
private Map<String, Object> filterOutputParams(final Map<String, Object> map) { |
229 | 237 |
final Map<String, Object> res = Maps.newHashMap(); |
238 |
|
|
230 | 239 |
if (map != null) { |
231 | 240 |
for (final String k : map.keySet()) { |
232 | 241 |
if (!StringUtils.isBlank(k) && (k.startsWith(WorkflowsConstants.DATASOURCE_PREFIX) || k.startsWith(WorkflowsConstants.MAIN_LOG_PREFIX))) { |
233 |
final String key = StringEscapeUtils.escapeXml11(k); |
|
234 | 242 |
final Object v = map.get(k); |
235 |
res.put(key, v != null ? StringEscapeUtils.escapeXml11(v.toString()) : "null"); |
|
243 |
if (v != null) { |
|
244 |
res.put(StringEscapeUtils.escapeXml11(k), StringEscapeUtils.escapeXml11(v.toString())); |
|
245 |
} |
|
236 | 246 |
} |
237 | 247 |
} |
238 | 248 |
} |
modules/dnet-msro-service/trunk/src/main/java/eu/dnetlib/msro/workflows/procs/WorkflowProcess.java | ||
---|---|---|
234 | 234 |
this.errorStacktrace = errorStacktrace; |
235 | 235 |
} |
236 | 236 |
|
237 |
public Map<String, String> calculateLogDetails() { |
|
238 |
// TODO Auto-generated method stub |
|
239 |
return null; |
|
240 |
} |
|
241 |
|
|
242 | 237 |
} |
modules/dnet-msro-service/trunk/src/main/java/eu/dnetlib/msro/workflows/util/WorkflowsConstants.java | ||
---|---|---|
26 | 26 |
public static final String LOG_SYSTEM_ERROR_STACKTRACE = "system:error:stacktrace"; |
27 | 27 |
|
28 | 28 |
public static final String LOG_DATASOURCE_NAME = WorkflowsConstants.DATASOURCE_PREFIX + "name"; |
29 |
public static final String LOG_DATASOURCE_ID = WorkflowsConstants.DATASOURCE_PREFIX + "id"; |
|
30 |
public static final String LOG_DATASOURCE_INTERFACE = WorkflowsConstants.DATASOURCE_PREFIX + "interface"; |
|
29 | 31 |
|
30 | 32 |
// public static final String SYSTEM_START_HUMAN_DATE = "system:startHumanDate"; |
31 | 33 |
// public static final String SYSTEM_START_DATE = "system:startDate"; |
... | ... | |
38 | 40 |
public static final String BLACKBOARD_IS_GOING = "blackboard:isOngoing"; |
39 | 41 |
public static final String BLACKBOARD_PARAM_PREFIX = "blackboard:param:"; |
40 | 42 |
|
41 |
// public static final String DATASOURCE_ID = WorkflowsConstants.DATASOURCE_PREFIX + "id"; |
|
42 |
|
|
43 | 43 |
// public static final String DATASOURCE_ACRONYM = WorkflowsConstants.DATASOURCE_PREFIX + "acronym"; |
44 | 44 |
// public static final String DATASOURCE_URL = WorkflowsConstants.DATASOURCE_PREFIX + "url"; |
45 |
// public static final String DATASOURCE_INTERFACE = WorkflowsConstants.DATASOURCE_PREFIX + "interface"; |
|
46 | 45 |
|
47 | 46 |
public static final int MIN_WF_PRIORITY = 0; |
48 | 47 |
public static final int MAX_WF_PRIORITY = 100; |
modules/dnet-modular-uis/trunk/src/main/java/eu/dnetlib/functionality/modular/ui/workflows/controllers/WorkflowsController.java | ||
---|---|---|
5 | 5 |
import java.time.LocalDate; |
6 | 6 |
import java.time.LocalDateTime; |
7 | 7 |
import java.time.format.DateTimeFormatter; |
8 |
import java.util.*; |
|
8 |
import java.util.Collection; |
|
9 |
import java.util.Collections; |
|
10 |
import java.util.Comparator; |
|
11 |
import java.util.HashMap; |
|
12 |
import java.util.Iterator; |
|
13 |
import java.util.List; |
|
14 |
import java.util.Map; |
|
15 |
import java.util.Set; |
|
16 |
|
|
9 | 17 |
import javax.annotation.Resource; |
10 | 18 |
import javax.servlet.http.HttpServletResponse; |
11 | 19 |
|
20 |
import org.apache.commons.io.IOUtils; |
|
21 |
import org.apache.commons.lang3.StringUtils; |
|
22 |
import org.apache.commons.lang3.math.NumberUtils; |
|
23 |
import org.apache.commons.logging.Log; |
|
24 |
import org.apache.commons.logging.LogFactory; |
|
25 |
import org.dom4j.Document; |
|
26 |
import org.dom4j.Element; |
|
27 |
import org.dom4j.Node; |
|
28 |
import org.dom4j.io.SAXReader; |
|
29 |
import org.springframework.beans.factory.annotation.Value; |
|
30 |
import org.springframework.core.io.ClassPathResource; |
|
31 |
import org.springframework.stereotype.Controller; |
|
32 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
33 |
import org.springframework.web.bind.annotation.RequestParam; |
|
34 |
import org.springframework.web.bind.annotation.ResponseBody; |
|
35 |
|
|
12 | 36 |
import com.google.common.base.Function; |
13 | 37 |
import com.google.common.base.Splitter; |
14 | 38 |
import com.google.common.collect.Iterators; |
... | ... | |
17 | 41 |
import com.google.common.collect.Sets; |
18 | 42 |
import com.google.gson.Gson; |
19 | 43 |
import com.google.gson.reflect.TypeToken; |
44 |
|
|
20 | 45 |
import eu.dnetlib.functionality.modular.ui.AbstractAjaxController; |
21 | 46 |
import eu.dnetlib.functionality.modular.ui.repositories.objects.RepoHIWorkflow; |
22 | 47 |
import eu.dnetlib.functionality.modular.ui.repositories.objects.VocabularyEntry; |
... | ... | |
37 | 62 |
import eu.dnetlib.msro.workflows.util.WorkflowsConstants; |
38 | 63 |
import eu.dnetlib.rmi.data.ProtocolParameter; |
39 | 64 |
import eu.dnetlib.rmi.enabling.ISLookUpException; |
40 |
import org.apache.commons.io.IOUtils; |
|
41 |
import org.apache.commons.lang3.StringUtils; |
|
42 |
import org.apache.commons.lang3.math.NumberUtils; |
|
43 |
import org.apache.commons.logging.Log; |
|
44 |
import org.apache.commons.logging.LogFactory; |
|
45 |
import org.dom4j.Document; |
|
46 |
import org.dom4j.Element; |
|
47 |
import org.dom4j.Node; |
|
48 |
import org.dom4j.io.SAXReader; |
|
49 |
import org.springframework.beans.factory.annotation.Value; |
|
50 |
import org.springframework.core.io.ClassPathResource; |
|
51 |
import org.springframework.stereotype.Controller; |
|
52 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
53 |
import org.springframework.web.bind.annotation.RequestParam; |
|
54 |
import org.springframework.web.bind.annotation.ResponseBody; |
|
55 | 65 |
|
56 | 66 |
/** |
57 | 67 |
* Web controller for the UI |
... | ... | |
234 | 244 |
final Iterator<ProcessInfo> iter = Iterators.transform(this.dnetLogger.range(startDate, endDate), new JournalEntryFunction()); |
235 | 245 |
while (iter.hasNext()) { |
236 | 246 |
final ProcessInfo e = iter.next(); |
237 |
e.setProcId("LOG: " + e.getProcId()); |
|
238 | 247 |
res.put(e.getProcId(), e); |
239 | 248 |
} |
240 | 249 |
|
241 | 250 |
final LocalDateTime now = LocalDateTime.now(); |
242 | 251 |
if (startDate.isBefore(now) && endDate.isAfter(now)) { |
243 | 252 |
for (final WorkflowProcess proc : this.graphProcessRegistry.listProcesses()) { |
244 |
final ProcessInfo p = new ProcessInfo(proc); |
|
245 |
|
|
246 |
p.setProcId("REG: " + p.getProcId()); |
|
247 |
|
|
248 |
res.put(proc.getId(), p); |
|
249 |
|
|
253 |
res.put(proc.getId(), new ProcessInfo(proc)); |
|
250 | 254 |
} |
251 | 255 |
} |
252 | 256 |
|
Also available in: Unified diff
fixed a bug with log viewer