ComposantsComponents

ComposantsComponents › Logs & ErreursLogs & Errors

tWarn

tWarn

Logs & ErreursLogs & Errors

Envoie un message (un texte, un code, une priorité) aux tLogCatcher du job, sans arrêter le job. C'est le tLogCatcher qui en fait quelque chose : l'afficher, l'écrire dans un fichier ou une table. Sans tLogCatcher, le tWarn n'écrit rien dans la console ; il range seulement ses trois valeurs dans des variables globales. Pour arrêter le job, prenez un tDie. Sends a message (a text, a code, a priority) to the tLogCatcher components of the job, without stopping the job. The tLogCatcher is what does something with it: print it, write it to a file or a table. Without a tLogCatcher, the tWarn writes nothing to the console; it only stores its three values in global variables. To stop the job, take a tDie.

EntréeInput

Aucune : il peut commencer un sous-job. Sinon un lien Main (un message par ligne) ou Iterate (un message par itération). None: it can start a subjob. Otherwise one Main link (one message per row) or Iterate link (one message per iteration).

SortieOutput

Facultative : un lien Main ; les lignes repartent telles quelles. Le message, lui, part vers les tLogCatcher. Optional: one Main link; the rows go on unchanged. The message itself goes to the tLogCatcher components.

Déclencheurs en sortieOutput triggers

On Subjob Ok On Subjob Error On Component Ok On Component Error Run if

On Subjob : seulement quand il commence son sous-job. On Subjob: only when it starts its subjob.

UtilisationUsage

Signaler une étape ou une anomalieReport a step or an anomaly

OnSubjobOk row1 (Main) tFileInputDelimited_1 tWarn_1 tLogCatcher_1 tFileOutputDelimited_1

Le tWarn et le tLogCatcher ne sont pas reliés : le tLogCatcher, posé à part dans le job, reçoit les messages de tous les tWarn. Son sous-job s'exécute à chaque message. The tWarn and the tLogCatcher are not connected: the tLogCatcher, placed apart in the job, receives the messages of every tWarn. Its subjob runs for each message.

Un message par ligneOne message per row

row1 (Reject) row2 (Main) tFilterRow_1 tWarn_1 tFileOutputDelimited_1

Dans un flux, le message et le code peuvent reprendre les valeurs de la ligne : "Rejected: " + row2.name. La ligne continue ensuite vers la sortie, inchangée. In a flow, the message and the code can use the values of the row: "Rejected: " + row2.name. The row then goes on to the output, unchanged.

  1. Déposez le tWarn depuis la famille Logs & Erreurs de la palette, à l'endroit du job où le message doit partir. Drop the tWarn from the Logs & Errors family of the palette, at the place of the job where the message must be sent.
  2. Écrivez le Message d'avertissement (expression Java entre guillemets), le Code (un entier) et choisissez la Priorité. Write the Warn message (Java expression in quotes), the Code (an integer) and choose the Priority.
  3. Ajoutez un tLogCatcher au job, case Capturer les tWarn cochée, et reliez sa sortie à un tLogRow ou à un composant d'écriture. Add a tLogCatcher to the job, Catch tWarn box checked, and connect its output to a tLogRow or to a writing component.

Paramètres simplesBasic settings

Les libellés sont ceux de l'onglet Composant ; le nom technique, en gris, est celui du paramètre dans le fichier du job. Le composant n'a pas de paramètres avancés propres. Labels are those of the Component tab; the technical name, in grey, is the parameter name in the job file. The component has no advanced settings of its own.

ParamètreSetting DéfautDefault VisibleShown Description
Message d'avertissementWarn messageMESSAGE "this is a warning" ToujoursAlways Texte du message, expression Java de type String. Il arrive dans la colonne message du tLogCatcher. Il peut reprendre une variable de contexte, une variable globale ou, dans un flux, une colonne de la ligne. Text of the message, Java expression of type String. It arrives in the message column of the tLogCatcher. It can use a context variable, a global variable or, in a flow, a column of the row.
CodeCODE 42 ToujoursAlways Un entier de votre choix, expression Java de type int, sans guillemets. Il arrive dans la colonne code du tLogCatcher : à vous de lui donner un sens (un numéro par genre d'avertissement, par exemple). Il ne change pas le code de sortie du job. Ne le laissez pas vide (voir Pièges). An integer of your choice, Java expression of type int, without quotes. It arrives in the code column of the tLogCatcher: its meaning is up to you (one number per kind of warning, for example). It does not change the exit code of the job. Do not leave it empty (see Pitfalls).
PrioritéPriorityPRIORITY AvertissementWarning ToujoursAlways Gravité du message : Trace, Debug, Info, Avertissement, Erreur ou Fatal. Le tLogCatcher reçoit un nombre de 1 à 6 (voir le tableau). Ce n'est qu'une étiquette : même Fatal n'arrête pas le job. Severity of the message: Trace, Debug, Info, Warning, Error or Fatal. The tLogCatcher receives a number from 1 to 6 (see the table). It is only a label: even Fatal does not stop the job.

Priorités et variables globalesPriorities and global variables

Le nombre de chaque prioritéThe number of each priority

PrioritéPriority Colonne prioritypriority column Niveau Log4jLog4j level
Trace1trace
Debug2debug
Info3info
AvertissementWarning4warn
ErreurError5error
Fatal6fatal

Les nombres ont été relevés dans un job de six tWarn, un par priorité. Le niveau Log4j est lu dans le modèle du composant (tWarn_main.javajet), sans exécution : quand Log4j est activé dans les propriétés du projet, le tWarn écrit aussi, à ce niveau, tWarn_1 - Message: , le message, . Code: et le code. The numbers were read from a job of six tWarn components, one per priority. The Log4j level is read from the template of the component (tWarn_main.javajet), without a run: when Log4j is activated in the project settings, the tWarn also writes, at that level, tWarn_1 - Message: , the message, . Code: and the code.

Variables globalesGlobal variables

WARN_MESSAGES String
Le message envoyé.The message sent.
WARN_CODE Integer
Le code.The code.
WARN_PRIORITY Integer
La priorité, de 1 à 6.The priority, from 1 to 6.
((String) globalMap.get("tWarn_1_WARN_MESSAGES"))
((Integer) globalMap.get("tWarn_1_WARN_CODE"))
((Integer) globalMap.get("tWarn_1_WARN_PRIORITY"))

Disponibles après le composant, avec ou sans tLogCatcher. Dans un flux, elles gardent les valeurs de la dernière ligne. Available after the component, with or without a tLogCatcher. In a flow, they keep the values of the last row.

ExemplesExamples

Sorties copiées depuis une exécution des jobs. Le tLogCatcher a douze colonnes ; pour tenir dans la page, un tFilterColumns n'en garde ici que cinq avant le tLogRow en mode Table. Les douze sont décrites sur la page du tLogCatcher. Sur cette page, le nom des jobs est remplacé par MyJob. Outputs copied from a run of the jobs. The tLogCatcher has twelve columns; to fit in the page, a tFilterColumns keeps only five of them here before the tLogRow in Table mode. The twelve are described on the tLogCatcher page. On this page, the job names are replaced with MyJob.

Un avertissement captéA warning caught

OnSubjobOk OnSubjobOk row1 (Main) row2 (Main) tJava_1 tWarn_1 tJava_2 tLogCatcher_1 tFilterColumns_1 tLogRow_1

Message "Stock is low", Code 7, Priorité Avertissement. tJava_1 écrit Start ; tJava_2 affiche les trois variables globales. Message "Stock is low", Code 7, Priority Warning. tJava_1 writes Start; tJava_2 prints the three global variables.

Start
.--------+-----+-------+------------+----.
|               tLogRow_1                |
|=-------+-----+-------+------------+---=|
|priority|type |origin |message     |code|
|=-------+-----+-------+------------+---=|
|4       |tWarn|tWarn_1|Stock is low|7   |
'--------+-----+-------+------------+----'

WARN_MESSAGES = Stock is low
WARN_CODE = 7
WARN_PRIORITY = 4

Le sous-job du tLogCatcher s'exécute pendant le tWarn : son tableau sort avant la suite du job. Le job se termine avec le code 0. The subjob of the tLogCatcher runs during the tWarn: its table comes out before the rest of the job. The job ends with code 0.

Sans tLogCatcher, réglages par défautWithout a tLogCatcher, default settings

OnSubjobOk tWarn_1 tJava_1

Le tJava affiche les variables globales : The tJava prints the global variables:

WARN_MESSAGES = this is a warning
WARN_CODE = 42
WARN_PRIORITY = 4

Le tWarn lui-même n'écrit rien. Même résultat avec un tLogCatcher dont la case Capturer les tWarn est décochée : son sous-job ne s'exécute pas. The tWarn itself writes nothing. Same result with a tLogCatcher whose Catch tWarn box is unchecked: its subjob does not run.

Deux tLogCatcherTwo tLogCatcher components

Un tWarn, deux tLogCatcher reliés chacun à un tLogRow en mode Simple (les douze colonnes ; le nom du job est remplacé par MyJob) : chacun reçoit le message. One tWarn, two tLogCatcher components each connected to a tLogRow in Basic mode (the twelve columns; the job name is replaced with MyJob): each one receives the message.

2026-11-18 14:33:00|Xbl8dE|Xbl8dE|Xbl8dE|DEMO|MyJob|Default|4|tWarn|tWarn_1|Stock is low|7
2026-11-18 14:33:00|Xbl8dE|Xbl8dE|Xbl8dE|DEMO|MyJob|Default|4|tWarn|tWarn_1|Stock is low|7

Dans un fluxIn a flow

row1 (Main) row2 (Main) row3 (Main) row4 (Main) tFixedFlowInput_1 tWarn_1 tLogRow_1 tLogCatcher_1 tFilterColumns_1 tLogRow_2

Trois lignes (id Integer, name String). Message "Row " + row1.id + ": " + row1.name, Code row1.id, Priorité Info. tLogRow_1 est en mode Simple. Un tJava, après le sous-job, affiche les variables globales. Three rows (id Integer, name String). Message "Row " + row1.id + ": " + row1.name, Code row1.id, Priority Info. tLogRow_1 is in Basic mode. A tJava, after the subjob, prints the global variables.

.--------+-----+-------+------------+----.
|               tLogRow_2                |
|=-------+-----+-------+------------+---=|
|priority|type |origin |message     |code|
|=-------+-----+-------+------------+---=|
|3       |tWarn|tWarn_1|Row 1: Paris|1   |
'--------+-----+-------+------------+----'

1|Paris
.--------+-----+-------+-----------+----.
|               tLogRow_2               |
|=-------+-----+-------+-----------+---=|
|priority|type |origin |message    |code|
|=-------+-----+-------+-----------+---=|
|3       |tWarn|tWarn_1|Row 2: Lyon|2   |
'--------+-----+-------+-----------+----'

2|Lyon
.--------+-----+-------+-----------+----.
|               tLogRow_2               |
|=-------+-----+-------+-----------+---=|
|priority|type |origin |message    |code|
|=-------+-----+-------+-----------+---=|
|3       |tWarn|tWarn_1|Row 3: Nice|3   |
'--------+-----+-------+-----------+----'

3|Nice
WARN_MESSAGES = Row 3: Nice
WARN_CODE = 3
WARN_PRIORITY = 3

Pour chaque ligne, le sous-job du tLogCatcher s'exécute en entier (d'où un tableau par message), puis la ligne continue vers tLogRow_1. Les variables globales gardent la dernière ligne. For each row, the subjob of the tLogCatcher runs in full (hence one table per message), then the row goes on to tLogRow_1. The global variables keep the last row.

PiègesPitfalls

Code videEmpty code

Le Code est recopié tel quel dans le code Java. Vide, le job ne compile pas (messages abrégés) : The Code is copied as is into the Java code. Empty, the job does not compile (shortened messages):

MyJob.java:426: error: illegal start of expression
	tLogCatcher_1.addMessage("tWarn", "tWarn_1", 4, "Stock is low", );
	                                                                ^
MyJob.java:430: error: illegal start of expression
	globalMap.put("tWarn_1_WARN_CODE", );
	                                   ^

Écrivez toujours un entier, 0 à défaut. Sans tLogCatcher, seule la seconde erreur apparaît. Always write an integer, 0 if nothing else. Without a tLogCatcher, only the second error appears.

Code nul dans un fluxNull code in a flow

Code row1.id, colonne Integer, nulle sur la deuxième des trois lignes. Sortie abrégée (tLogRow du flux en mode Simple) : Code row1.id, an Integer column, null on the second of the three rows. Shortened output (tLogRow of the flow in Basic mode):

…
1|Paris
tWarn_1 - tWarn failed to log message due to internal error: java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because "<local7>.id" is null
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because "<local7>.id" is null
	at demo.myjob_0_1.MyJob.tFixedFlowInput_1Process(MyJob.java:1251)
	…
|Lyon
…
3|Nice

Le message de cette ligne est perdu : le tLogCatcher ne le reçoit pas. L'erreur est écrite, mais le job continue (la ligne |Lyon est bien sortie) et se termine avec le code 0. Protégez l'expression : row1.id == null ? 0 : row1.id. The message of that row is lost: the tLogCatcher does not receive it. The error is written, but the job goes on (the |Lyon row did come out) and ends with code 0. Protect the expression: row1.id == null ? 0 : row1.id.

Fatal n'arrête rienFatal stops nothing

Un tWarn de priorité Fatal suivi d'un tJava : le tJava s'exécute et le job se termine avec le code 0. La priorité et le code ne servent qu'à ceux qui lisent le message. Pour arrêter le job avec un code de sortie, c'est le tDie. A tWarn of Fatal priority followed by a tJava: the tJava runs and the job ends with code 0. The priority and the code are only for those who read the message. To stop the job with an exit code, use the tDie.

Le tLogCatcher s'exécute dans le tWarnThe tLogCatcher runs inside the tWarn

Le tWarn attend la fin du sous-job du tLogCatcher avant de continuer. Dans un flux, ce sous-job repart de zéro à chaque ligne : s'il ouvre une connexion ou un fichier, il le fait autant de fois. Sur un gros flux, comptez les anomalies et envoyez un seul tWarn après le sous-job. The tWarn waits for the end of the subjob of the tLogCatcher before going on. In a flow, that subjob starts from scratch for each row: if it opens a connection or a file, it does so as many times. On a large flow, count the anomalies and send a single tWarn after the subjob.

Une erreur du tLogCatcher passe inaperçueAn error of the tLogCatcher goes unnoticed

Si le sous-job du tLogCatcher échoue (fichier impossible à écrire, par exemple), le tWarn écrit tWarn_1 - tWarn failed to log message due to internal error: … sur la sortie d'erreur et le job continue. Voir les pièges du tLogCatcher. If the subjob of the tLogCatcher fails (a file that cannot be written, for example), the tWarn writes tWarn_1 - tWarn failed to log message due to internal error: … to the error output and the job goes on. See the tLogCatcher pitfalls.

Seulement dans son jobOnly in its own job

Le tWarn ne s'adresse qu'aux tLogCatcher du job où il se trouve : ceux-ci sont recherchés quand le code du job est généré. Un tWarn d'un job enfant, lancé par un tRunJob, n'atteint pas le tLogCatcher du job parent. The tWarn only addresses the tLogCatcher components of the job it is in: they are looked up when the code of the job is generated. A tWarn of a child job, started by a tRunJob, does not reach the tLogCatcher of the parent job.

ConseilsTips

Un code par genre de messageOne code per kind of message

Le texte change, le code reste : donnez un numéro à chaque genre d'avertissement du projet (fichier vide, rejet, délai dépassé…). Une table de journal se filtre alors sur code et priority, sans chercher dans les textes. The text changes, the code stays: give a number to each kind of warning of the project (empty file, reject, timeout…). A log table can then be filtered on code and priority, without searching the texts.

Un résumé après le fluxA summary after the flow

Relié par On Subjob Ok, le tWarn peut reprendre les compteurs du sous-job : "Rows read: " + globalMap.get("tFileInputDelimited_1_NB_LINE"). Avec un Run if, il ne part que si une condition est vraie. Connected with On Subjob Ok, the tWarn can use the counters of the subjob: "Rows read: " + globalMap.get("tFileInputDelimited_1_NB_LINE"). With a Run if, it is only sent when a condition is true.

Voir aussiSee also