Musar sur L’Ecclésiaste 9:4

כִּי־מִי֙ אֲשֶׁ֣ר יבחר [יְחֻבַּ֔ר] אֶ֥ל כָּל־הַחַיִּ֖ים יֵ֣שׁ בִּטָּח֑וֹן כִּֽי־לְכֶ֤לֶב חַי֙ ה֣וּא ט֔וֹב מִן־הָאַרְיֵ֖ה הַמֵּֽת׃

Or, qui demeure dans la société des vivants peut avoir quelque espoir, car un chien vivant vaut mieux qu’un lion mort.

Shaarei Teshuvah

And likewise did King Solomon, peace be upon him, say (Kohelet 9:4) "For he who is connected with the living has hope - even a live dog is better than a dead lion." Its explanation is that he praised life in this world with regards to repentance, performance of commandment[s] and attainment of spiritual virtues. And this is the hope that is found for those connected with the living. And the explanation of "even a live dog" is that even a lowly man that is alive can add to his spiritual virtues - which is not the case for a righteous sage that is dead. But in another place, he disgraced and condemned this world, regarding the attainment of pleasures and honor, and said (Kohelet 1:3) "What advantage is there for a man in all of his toil that he does beneath the sun?" And he also said (Kohelet 4:2), "Then I accounted those who died long since more fortunate than those who are still living."