|
65 | 65 | # print the buffer, so we have a "classic' logger back in sync. |
66 | 66 | sys.stdout.write(bufContent) |
67 | 67 | # now the remote logger. |
68 | | - remote = pilotParams.pilotLogging and (pilotParams.loggerURL is not None) |
69 | | - if remote: |
| 68 | + remote = pilotParams.pilotLogging and pilotParams.diracXServer |
| 69 | + if remote and pilotParams.jwt != {}: |
70 | 70 | # In a remote logger enabled Dirac version we would have some classic logger content from a wrapper, |
71 | 71 | # which we passed in: |
72 | 72 | receivedContent = "" |
73 | 73 | if not sys.stdin.isatty(): |
74 | 74 | receivedContent = sys.stdin.read() |
| 75 | + |
75 | 76 | log = RemoteLogger( |
76 | | - pilotParams.loggerURL, |
| 77 | + pilotParams.diracXServer, |
77 | 78 | "Pilot", |
78 | 79 | bufsize=pilotParams.loggerBufsize, |
79 | 80 | pilotUUID=pilotParams.pilotUUID, |
80 | 81 | debugFlag=pilotParams.debugFlag, |
81 | | - wnVO=pilotParams.wnVO, |
| 82 | + jwt=pilotParams.jwt, |
| 83 | + legacy_logging=pilotParams.isLegacyLogging, |
| 84 | + clientID=pilotParams.clientID |
82 | 85 | ) |
83 | 86 | log.info("Remote logger activated") |
84 | | - log.buffer.write(receivedContent) |
| 87 | + log.buffer.write(log.format_to_json( |
| 88 | + "INFO", |
| 89 | + receivedContent, |
| 90 | + )) |
85 | 91 | log.buffer.flush() |
86 | | - log.buffer.write(bufContent) |
| 92 | + log.buffer.write(log.format_to_json( |
| 93 | + "INFO", |
| 94 | + bufContent, |
| 95 | + )) |
87 | 96 | else: |
88 | 97 | log = Logger("Pilot", debugFlag=pilotParams.debugFlag) |
89 | 98 |
|
|
106 | 115 |
|
107 | 116 | log.info("Executing commands: %s" % str(pilotParams.commands)) |
108 | 117 |
|
109 | | - if remote: |
| 118 | + if remote and pilotParams.jwt: |
110 | 119 | # It's safer to cancel the timer here. Each command has got its own logger object with a timer cancelled by the |
111 | 120 | # finaliser. No need for a timer in the "else" code segment below. |
112 | 121 | try: |
|
124 | 133 | log.error("Command %s could not be instantiated" % commandName) |
125 | 134 | # send the last message and abandon ship. |
126 | 135 | if remote: |
127 | | - log.buffer.flush() |
| 136 | + log.buffer.flush(force=True) |
128 | 137 | sys.exit(-1) |
129 | | - |
| 138 | + |
130 | 139 | log.info("Pilot tasks finished.") |
131 | 140 |
|
132 | 141 | if pilotParams.jwt: |
133 | | - if not pilotParams.isLegacyPilot: |
| 142 | + if remote: |
| 143 | + log.buffer.flush(force=True) |
| 144 | + |
| 145 | + if not pilotParams.isLegacyLogging: |
134 | 146 | log.info("Revoking pilot token.") |
135 | 147 | revokePilotToken( |
136 | 148 | pilotParams.diracXServer, |
|
0 commit comments