m_c,
Another option which avoids the risk of reverse breakdown of the LED would be to connect the LED (with a suitable series resistor) to ground after the switch to 5v. This will not fully confirm that the 24v is pulled down but will indicate that the circuit has been operated.
I assume that 'switch' isn't really a switch (otherwise you'd be switching the 24v directly) so you would have to confirm the actual device can deliver the LED current as well as the base current of the transistor.

If you stick with the design as shown remember that the LED current must be added to the load current when rating the transistor and calculating the base current and hence resistor value.