Lombok: @ToString(linebreak=true)

Created on 30 Mar 2018  ·  3Comments  ·  Source: projectlombok/lombok

I think an attribute linebreak for @ToString is good for reading, and it should be easy to implement, just replace ',' with ",\n".
This is desired especially for "complex" object, e.g.,

For example:

Actual below is one line in fact

[Application(allocatedMB=-1, allocatedVCores=-1, amContainerLogs=http://worker:8042/node/containerlogs/container_1522385449888_0002_01_000001/insight, amHostHttpAddress=worker:8042, applicationTags=, applicationType=SPARK, clusterId=1522385449888, diagnostics=Kill application application_1522385449888_0002 received from insight (auth:SIMPLE), elapsedTime=426971, finalStatus=KILLED, finishedTime=1522385993313, id=application_1522385449888_0002, memorySeconds=3342632, name=Thrift JDBC/ODBC Server, numAMContainerPreempted=0, numNonAMContainerPreempted=0, preemptedResourceMB=0, preemptedResourceVCores=0, progress=100, queue=default, runningContainers=-1, startedTime=1522385566342, state=KILLED, trackingUI=History, trackingUrl=http://yarn-rm:8088/cluster/app/application_1522385449888_0002, user=insight, vcoreSeconds=1707), Application(allocatedMB=-1, allocatedVCores=-1, amContainerLogs=http://yarn-nm:8042/node/containerlogs/container_1522385449888_0001_02_000001/insight, amHostHttpAddress=yarn-nm:8042, applicationTags=, applicationType=SPARK, clusterId=1522385449888, diagnostics=Application application_1522385449888_0001 failed 2 times due to AM Container for appattempt_1522385449888_0001_000002 exited with exitCode: -1000
For more detailed output, check application tracking page:http://yarn-rm:8088/cluster/app/application_1522385449888_0001Then, click on links to logs of each attempt.
Diagnostics: java.io.FileNotFoundException: File does not exist: hdfs://hdfs-name:9000/apps/spark/breeze_2.11-0.13.2.jar._COPYING_
Failing this attempt. Failing the application., elapsedTime=5652, finalStatus=FAILED, finishedTime=1522385508882, id=application_1522385449888_0001, memorySeconds=6065, name=spark.jobserver.JobManager, numAMContainerPreempted=0, numNonAMContainerPreempted=0, preemptedResourceMB=0, preemptedResourceVCores=0, progress=0, queue=default, runningContainers=-1, startedTime=1522385503230, state=FAILED, trackingUI=History, trackingUrl=http://yarn-rm:8088/cluster/app/application_1522385449888_0001, user=insight, vcoreSeconds=3), Application(allocatedMB=1408, allocatedVCores=1, amContainerLogs=http://yarn-nm:8042/node/containerlogs/container_1522385449888_0003_01_000001/insight, amHostHttpAddress=yarn-nm:8042, applicationTags=, applicationType=SPARK, clusterId=1522385449888, diagnostics=, elapsedTime=37716969, finalStatus=UNDEFINED, finishedTime=0, id=application_1522385449888_0003, memorySeconds=54583660, name=spark.jobserver.JobManager, numAMContainerPreempted=0, numNonAMContainerPreempted=0, preemptedResourceMB=0, preemptedResourceVCores=0, progress=10, queue=default, runningContainers=1, startedTime=1522385938247, state=RUNNING, trackingUI=ApplicationMaster, trackingUrl=http://yarn-rm:8088/proxy/application_1522385449888_0003/, user=insight, vcoreSeconds=38930)]

Expected

[Application(allocatedMB=-1,
allocatedVCores=-1,
amContainerLogs=http://worker:8042/node/containerlogs/container_1522385449888_0002_01_000001/insight,
amHostHttpAddress=worker:8042,
applicationTags=,
applicationType=SPARK,
clusterId=1522385449888,
diagnostics=Kill application application_1522385449888_0002 received from insight (auth:SIMPLE),
elapsedTime=426971,
finalStatus=KILLED,
finishedTime=1522385993313,
id=application_1522385449888_0002,
memorySeconds=3342632,
name=Thrift JDBC/ODBC Server,
numAMContainerPreempted=0,
numNonAMContainerPreempted=0,
preemptedResourceMB=0,
preemptedResourceVCores=0,
progress=100,
queue=default,
runningContainers=-1,
startedTime=1522385566342,
state=KILLED,
trackingUI=History,
trackingUrl=http://yarn-rm:8088/cluster/app/application_1522385449888_0002,
user=insight,
vcoreSeconds=1707),
Application(allocatedMB=-1,
allocatedVCores=-1,
amContainerLogs=http://yarn-nm:8042/node/containerlogs/container_1522385449888_0001_02_000001/insight,
amHostHttpAddress=yarn-nm:8042,
applicationTags=,
applicationType=SPARK,
clusterId=1522385449888,
diagnostics=Application application_1522385449888_0001 failed 2 times due to AM Container for appattempt_1522385449888_0001_000002 exited with exitCode: -1000
For more detailed output,
check application tracking page:http://yarn-rm:8088/cluster/app/application_1522385449888_0001Then,
click on links to logs of each attempt.
Diagnostics: java.io.FileNotFoundException: File does not exist: hdfs://hdfs-name:9000/apps/spark/breeze_2.11-0.13.2.jar._COPYING_
Failing this attempt. Failing the application.,
elapsedTime=5652,
finalStatus=FAILED,
finishedTime=1522385508882,
id=application_1522385449888_0001,
memorySeconds=6065,
name=spark.jobserver.JobManager,
numAMContainerPreempted=0,
numNonAMContainerPreempted=0,
preemptedResourceMB=0,
preemptedResourceVCores=0,
progress=0,
queue=default,
runningContainers=-1,
startedTime=1522385503230,
state=FAILED,
trackingUI=History,
trackingUrl=http://yarn-rm:8088/cluster/app/application_1522385449888_0001,
user=insight,
vcoreSeconds=3),
Application(allocatedMB=1408,
allocatedVCores=1,
amContainerLogs=http://yarn-nm:8042/node/containerlogs/container_1522385449888_0003_01_000001/insight,
amHostHttpAddress=yarn-nm:8042,
applicationTags=,
applicationType=SPARK,
clusterId=1522385449888,
diagnostics=,
elapsedTime=37137315,
finalStatus=UNDEFINED,
finishedTime=0,
id=application_1522385449888_0003,
memorySeconds=53767506,
name=spark.jobserver.JobManager,
numAMContainerPreempted=0,
numNonAMContainerPreempted=0,
preemptedResourceMB=0,
preemptedResourceVCores=0,
progress=10,
queue=default,
runningContainers=1,
startedTime=1522385938247,
state=RUNNING,
trackingUI=ApplicationMaster,
trackingUrl=http://yarn-rm:8088/proxy/application_1522385449888_0003/,
user=insight,
vcoreSeconds=38351)]

Most helpful comment

There are probably a million different ways people may want to format their
toString output.

I'd like a more general solution. Maybe a configurable separation string or
a format specifier..

Op vr 30 mrt. 2018 17:21 schreef Leon notifications@github.com:

I think an attribute linebreak for @tostring https://github.com/tostring
is good for reading, and it should be easy to implement, just replace ','
with ",\n".

For example:

Actual

ClusterMetrics(activeNodes=2, allocatedMB=1408, allocatedVirtualCores=1,
appsCompleted=0, appsFailed=1, appsKilled=1, appsPending=0, appsRunning=1,
appsSubmitted=3, availableMB=31360, availableVirtualCores=63,
containersAllocated=1, containersPending=0, containersReserved=0,
decommissionedNodes=0, lostNodes=0, rebootedNodes=0, reservedMB=0,
reservedVirtualCores=0, totalMB=32768, totalNodes=2, totalVirtualCores=64,
unhealthyNodes=0)

Expected

ClusterMetrics(activeNodes=2,
allocatedMB=1408,
allocatedVirtualCores=1,
appsCompleted=0,
appsFailed=1,
appsKilled=1,
appsPending=0,
appsRunning=1,
appsSubmitted=3,
availableMB=31360,
availableVirtualCores=63,
containersAllocated=1,
containersPending=0,
containersReserved=0,
decommissionedNodes=0,
lostNodes=0,
rebootedNodes=0,
reservedMB=0,
reservedVirtualCores=0,
totalMB=32768,
totalNodes=2,
totalVirtualCores=64,
unhealthyNodes=0)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/rzwitserloot/lombok/issues/1637, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAKCRS7bxqsBVprfB6J-dwd_WYFMkV4Eks5tjk2OgaJpZM4TBzpD
.

All 3 comments

There are probably a million different ways people may want to format their
toString output.

I'd like a more general solution. Maybe a configurable separation string or
a format specifier..

Op vr 30 mrt. 2018 17:21 schreef Leon notifications@github.com:

I think an attribute linebreak for @tostring https://github.com/tostring
is good for reading, and it should be easy to implement, just replace ','
with ",\n".

For example:

Actual

ClusterMetrics(activeNodes=2, allocatedMB=1408, allocatedVirtualCores=1,
appsCompleted=0, appsFailed=1, appsKilled=1, appsPending=0, appsRunning=1,
appsSubmitted=3, availableMB=31360, availableVirtualCores=63,
containersAllocated=1, containersPending=0, containersReserved=0,
decommissionedNodes=0, lostNodes=0, rebootedNodes=0, reservedMB=0,
reservedVirtualCores=0, totalMB=32768, totalNodes=2, totalVirtualCores=64,
unhealthyNodes=0)

Expected

ClusterMetrics(activeNodes=2,
allocatedMB=1408,
allocatedVirtualCores=1,
appsCompleted=0,
appsFailed=1,
appsKilled=1,
appsPending=0,
appsRunning=1,
appsSubmitted=3,
availableMB=31360,
availableVirtualCores=63,
containersAllocated=1,
containersPending=0,
containersReserved=0,
decommissionedNodes=0,
lostNodes=0,
rebootedNodes=0,
reservedMB=0,
reservedVirtualCores=0,
totalMB=32768,
totalNodes=2,
totalVirtualCores=64,
unhealthyNodes=0)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/rzwitserloot/lombok/issues/1637, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAKCRS7bxqsBVprfB6J-dwd_WYFMkV4Eks5tjk2OgaJpZM4TBzpD
.

Yes, we don't want to do piecemeal improvements to toString like this; only a true flexible solution will be accepted.

Yes, we don't want to do piecemeal improvements to toString like this; only a true flexible solution will be accepted.

Hi @rzwitserloot .
So solution of

@ToString(separation="any string")

Can be acceptable?

Was this page helpful?
0 / 5 - 0 ratings