I try to read the source, but can't see the obvious I try to look on the helper class
/traccar/src/org/traccar/helper/Log.java it's not there and a couple of various places. can anyone shed somelight on this thanks!
StringBuilder s = new StringBuilder(); s.append(formatChannel(e.getChannel())).append(" "); s.append("id: ").append(uniqueId).append(", "); s.append("time: ").append( new SimpleDateFormat(Log.DATE_FORMAT).format(position.getFixTime())).append(", "); s.append("lat: ").append(String.format("%.5f", position.getLatitude())).append(", "); s.append("lon: ").append(String.format("%.5f", position.getLongitude())).append(", "); s.append("speed: ").append(String.format("%.1f", position.getSpeed())).append(", "); s.append("course: ").append(String.format("%.1f", position.getCourse())); Object cmdResult = position.getAttributes().get(Position.KEY_RESULT); if (cmdResult != null) { s.append(", result: ").append(cmdResult); } Log.info(s.toString());
Ok after digging the codebase even further I see it was on MainEventHandler.java the problem is Position model they way it designed is not returning this extra Input/Output sensor from device sure it was stored on the DB
The question is how can I bring this extra data Inputs as part of the String builder code above, thanks in advance
All addition parameters, like input/output, are store in the attributes, co you can get them using "getAttributes()" method. See the command result for an example.
Hi Anton,
Thanks for a speedy reply, I try a code below it build's perfectly but I don't know if I understood you correctly :)
Object cmdIo = position.getAttributes().get(Position.KEY_INPUT); if (cmdIo != null) { s.append(", input: ").append(cmdIo); }
Well, the key that you are using should match the one you want to print out.
Hi Anton,
I try all keys available from Position model to no avail it's always null I believed, I even try KEY_ORIGINAL just to make it sure it was not null but still no output from traccar-server.log
I'm sorry if I can't really find this trivial thing :)
From your first example, it seems like the keys you should be using are "io03" and "io27".
Hi Anton,
It's working now, thanks from your help much appreciate it :)
Hi Guys,
Is there any documented settings that will log not only the basic data like lon,lat and speed but the other IO attribute as well just like what have shown in the traccar-web portal.
The reason for this is i'm basically feeding the log to elastic search for visualizing purposes.
Current:
Expected: